J
John
I am having a weird error and maybe the synatax is different or something. I
use a SQL Stored Proc and pass it one param and get a return to either a
datareader or dataset. The code works fine for a datareader but the dataset
gives me a weird error. I even tried using the same SP with the two code
snippets, one works the other doesn't.
tmpSQL.SQLDB.Open()
tmpSQL.SQLCmd.CommandType = CommandType.StoredProcedure
tmpSQL.SQLCmd.CommandText = "SP_GETRECORDTEST"
SqlClient.SqlCommandBuilder.DeriveParameters(tmpSQL.SQLCmd) <<THIS SHOWS OK
PARAMS IN DEBUG WNDW
tmpSQL.SQLCmd.Parameters(1).Value = paramNbr << SEEMS TO IGNORE THIS
Dim DS As DataSet = New DataSet
Dim DA As SqlDataAdapter = New SqlDataAdapter(tmpSQL.SQLCmd.CommandText,
tmpSQL.SQLDB)
DA.Fill(DS) <<<<<<<<<BOOM says the SP expects param and it was not passed
but this code works....
tmpSQL.SQLDB.Open()
tmpSQL.SQLCmd.CommandType = CommandType.StoredProcedure
tmpSQL.SQLCmd.CommandText = "SP_GETRECORDAGAIN"
SqlClient.SqlCommandBuilder.DeriveParameters(tmpSQL.SQLCmd)
tmpSQL.SQLCmd.Parameters(1).Value = paramNBR
dReader = tmpSQL.SQLCmd.ExecuteReader()
dReader.Read()
I tried calling the SP_GETRECORDTEST with the datareader code and it works,
so I know the SP is OK..
I need the dataset to work for a datagrid I have, but can't get it to see
the param,
even tried a tmpSQL.SQLCmd.Parameters.Add("@tmpParam",2) with the DS
code..
did not make any difference..
Any Ideas?
Thanks JOHN
use a SQL Stored Proc and pass it one param and get a return to either a
datareader or dataset. The code works fine for a datareader but the dataset
gives me a weird error. I even tried using the same SP with the two code
snippets, one works the other doesn't.
tmpSQL.SQLDB.Open()
tmpSQL.SQLCmd.CommandType = CommandType.StoredProcedure
tmpSQL.SQLCmd.CommandText = "SP_GETRECORDTEST"
SqlClient.SqlCommandBuilder.DeriveParameters(tmpSQL.SQLCmd) <<THIS SHOWS OK
PARAMS IN DEBUG WNDW
tmpSQL.SQLCmd.Parameters(1).Value = paramNbr << SEEMS TO IGNORE THIS
Dim DS As DataSet = New DataSet
Dim DA As SqlDataAdapter = New SqlDataAdapter(tmpSQL.SQLCmd.CommandText,
tmpSQL.SQLDB)
DA.Fill(DS) <<<<<<<<<BOOM says the SP expects param and it was not passed
but this code works....
tmpSQL.SQLDB.Open()
tmpSQL.SQLCmd.CommandType = CommandType.StoredProcedure
tmpSQL.SQLCmd.CommandText = "SP_GETRECORDAGAIN"
SqlClient.SqlCommandBuilder.DeriveParameters(tmpSQL.SQLCmd)
tmpSQL.SQLCmd.Parameters(1).Value = paramNBR
dReader = tmpSQL.SQLCmd.ExecuteReader()
dReader.Read()
I tried calling the SP_GETRECORDTEST with the datareader code and it works,
so I know the SP is OK..
I need the dataset to work for a datagrid I have, but can't get it to see
the param,
even tried a tmpSQL.SQLCmd.Parameters.Add("@tmpParam",2) with the DS
code..
did not make any difference..
Any Ideas?
Thanks JOHN