Re: Please help!! How to get parameter back in ADO.NET

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: William \(Bill\) Vaughn (billvaRemoveThis_at_nwlink.com)
Date: 01/07/05


Date: Fri, 7 Jan 2005 15:17:20 -0800

First, we need a bit more information. What type of DBMS engine are you
using? Jet/Access, SQL Server, Oracle, 3x5Card?
Note the OUTPUT parameters ONLY work with stored procedures.
If you aren't using a SP, you need to query the newly created identity
value. http://www.betav.com/msdn_magazine.htm has an article that might
help.

-- 
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
<nashak@hotmail.com> wrote in message 
news:1105131052.467233.153010@f14g2000cwb.googlegroups.com...
> Hi,
>
> We are not using Stored Procedures. I need to get back the value of the
> primary key (ID) field of the table once I've inserted a new record.
>
> I have a Insert statement as follows:
> cmdInsertStudy.CommandText = "Insert into " & TableName & "(" & _
> strCol & ") values (@p1, @p2, @p3, @p4,
> @p5, @p6, @p7) "
>
> i.e passing 7 parameters.
>
> cmdInsertStudy.CommandType = CommandType.Text
> daStudy.InsertCommand = cmdInsertStudy
>
> 'Created new parameter to get the value of the ID field that
> 'is generated by sql server
>
> Dim myParam As SqlParameter =
> daStudy.InsertCommand.Parameters.Add("@StudyID", SqlDbType.Int, 10,
> "StudyID")
> myParam.Direction = ParameterDirection.Output
>
> daStudy.InsertCommand.Transaction = trname
> daStudy.Update(dsEmptyStudy, TableName)
>
> What do I do now?
>
>
> Thanks
> 


Relevant Pages

  • Re: What is Oracles version of MS SQL Profiler
    ... Tracking code path of a stored procedure (find out what is being ... I'm new to Oracle coming in from Sql Server. ... what I use to debug stored procedures and track performance. ...
    (comp.databases.oracle.server)
  • Extreme performance issues (SQL Server 2000/ADO.NET/C#)
    ... This process runs very quickly if run through Query ... same exact stored procedures and views, run in the same exact order, through ... system that runs SQL Server (a 4-cpu Xeons system with 2gigs of physical ... When I execute these steps manually through query analyser,, ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Securing Stored Procedures from being seen
    ... username, but in SQL Server, there are too many users to map an individuals ... granting the group execute permissions. ... but I would have to know what groups the user belongs ... see the names of any stored procedures to which he has no rights. ...
    (microsoft.public.sqlserver.security)
  • Re: Querying on dates in dd/mm/yyyy hh/mm/ss format using Access2002 And SQL Server 7
    ... For parsing a string to a date/time, the 103 format doesn't limits the user ... > which is used as the row source for the results form). ... > other solutions assuming I have to use SQL Server 7? ... > I don't understand how I can use parameterized stored procedures to solve ...
    (microsoft.public.access.adp.sqlserver)
  • Re: Migrate SQL Server Stored Procedures
    ... SQL Server uses Transact-SQL as a language and Oracle uses PL/SQL. ... > How can I migrate all SQL server Stored Procedures to Oracle adn Oracle ...
    (microsoft.public.sqlserver.programming)