Link to home
Start Free TrialLog in
Avatar of mgmhicks
mgmhicks

asked on

Cant add paramenter to data adapter

I have a data adapter I am trying to associate parameters to so I can run an da.update(ds) statement.  Here is my code.

 
Dim myCMD As New SqlCommand
        myCMD.Connection = myConn
        myCMD.CommandText = "TAG_UpdateSQFT"
        myCMD.CommandType = CommandType.StoredProcedure
        Dim param1 As New SqlParameter("@SQFT", SqlDbType.NVarChar, 10, "SQFT")
        Dim param2 As New SqlParameter("@ID", SqlDbType.Int, 10, "ID")
        myDA.UpdateCommand.Parameters.Add(New SqlParameter(param1))
        myDA.UpdateCommand.Parameters.Add(param2)
        myDA.UpdateCommand = myCMD

Open in new window


Keeps dealing me I need the new keyword.  Could someone help me out.

thanks in advance.
ASKER CERTIFIED SOLUTION
Avatar of Carl Tawn
Carl Tawn
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Or change the "myDA.UpdateCommand" in lines 7 and 8 to "myCMD".
Avatar of mgmhicks
mgmhicks

ASKER

thank you