hi, I'm trying to update a database using a stored procedure from a data
grid. the database is not updating using this code with the new dbgrid.
can anyone figure out where the problem/issue is? what must I change in
order for the update to occur in the db?
I'm not getting any errors in my code, but something else must be the
problem.
any advice? thanks in advance
Dim myConnectString As String = C_CONNECT
Dim dbprofConn As SqlConnection = New
SqlConnection(myConnectString)
Dim upexpadapter As New SqlDataAdapter()
Dim cmdupexp As SqlCommand = New SqlCommand("upinvexp",
dbprofConn)
upexpadapter.UpdateCommand = cmdupexp
upexpadapter.UpdateCommand.Connection = dbprofConn
dbprofConn.Open()
'upexpadapter.TableMappings.Add("table",
"virtual.dbo.invexceptions")
upexpadapter.UpdateCommand.CommandType =
CommandType.StoredProcedure
Dim sinv As New SqlParameter()
Dim speri As New SqlParameter()
Dim svend As New SqlParameter()
Dim snwamt As New SqlParameter()
Dim sreqprm As New SqlParameter()
With sinv
.SourceColumn = "invoice"
.SourceVersion = DataRowVersion.Original
.ParameterName = "@vinv"
.SqlDbType = SqlDbType.VarChar
End With
'sinv.SourceColumn = "invoice"
With speri
.SourceColumn = "period"
.SourceVersion = DataRowVersion.Original
.SqlDbType = SqlDbType.VarChar
.ParameterName = "@vper"
End With
'speri.SourceColumn = "period"
With svend
.SourceColumn = "vendor"
.SourceVersion = DataRowVersion.Original
.SqlDbType = SqlDbType.VarChar
.ParameterName = "@vend"
End With
With snwamt
.SourceColumn = "newamt"
.SourceVersion = DataRowVersion.Current
.SqlDbType = SqlDbType.Decimal
.ParameterName = "@vnewamt"
End With
With sreqprm
.SourceColumn = "reqperm"
.SourceVersion = DataRowVersion.Current
.SqlDbType = SqlDbType.VarChar
.ParameterName = "@vreqperm"
End With
upexpadapter.UpdateCommand.Parameters.Add(sinv)
upexpadapter.UpdateCommand.Parameters.Add(speri)
upexpadapter.UpdateCommand.Parameters.Add(svend)
upexpadapter.UpdateCommand.Parameters.Add(snwamt)
upexpadapter.UpdateCommand.Parameters.Add(sreqprm)
grdexceptions.SetDataBinding(ExceptionData,
EXCEPTION_TABLE_NAME)
'send the update query to the database
upexpadapter.Update(ExceptionData, EXCEPTION_TABLE_NAME)
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!