473,407 Members | 2,676 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

sqldataadpter.update - stored procedure help

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
1 1808
* 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: David Berman | last post by:
I'm having a problem with an update operation in a stored procedure. It runs so slowly that it is unusable, unless I comment a part out in which case it is very fast. However, I need the whole...
7
by: Alex | last post by:
Hi all, I am trying to install a java stored procedure via the windows development centre. The linux box is running 8.1 FP4 as is the windoze platform. If I am on the linux box i can install...
18
by: Bill Smith | last post by:
The initial row is inserted with the colPartNum column containing a valid LIKE pattern, such as (without the single quotes) 'AB%DE'. I want to update the column value with the results of a query...
9
by: joun | last post by:
Hi all, i'm using this code to insert records into an Access table from asp.net, using a stored procedure, called qry_InsertData: PARAMETERS Long, Long, Text(20), Long, DateTime; INSERT...
5
by: wpellett | last post by:
I can not get the SQL compiler to rewrite my SQL UPDATE statement to include columns being SET in a Stored Procedure being called from a BEFORE UPDATE trigger. Example: create table...
10
by: Ivan | last post by:
Hi to all !!! I have one stored procedure that update and delete rows in differents tables, but when I try of delete of the main table this show problems with primary and foreign key. I DROP...
1
by: Sharon | last post by:
Hello All, Is it possible to update Sql Table through DataGrid. I have a DataGrid which is being populated through a stored procedure, all i wanted to do is to update one field...
4
by: =?Utf-8?B?QmFidU1hbg==?= | last post by:
Hi, I have a GridView and a SqlDataSource controls on a page. The SqlDataSource object uses stored procedures to do the CRUD operations. The DataSource has three columns one of which -...
0
by: svgeorge | last post by:
I want to update several tables using one stored procedure. How can i do this I mean the syntax.etc. declaration etc. I know the basic syntax as below CREATE PROCEDURE <Procedure_Name, sysname,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.