By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,992 Members | 967 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,992 IT Pros & Developers. It's quick & easy.

sqldataadpter.update - stored procedure help

P: n/a
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!
Nov 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
* larry mckay <la***@larrymckay.com> scripsit:
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?


Notice that a separate group for ADO.NET related question is available:

<news://msnews.microsoft.com/microsoft.public.dotnet.framework.adonet>

Web interface:

<http://msdn.microsoft.com/newsgroups/default.asp?url=/newsgroups/loadframes.asp?icp=msdn&slcid=us&newsgroup=microso ft.public.dotnet.framework.adonet>

--
Herfried K. Wagner
MVP VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.