|
-
Jun 12th, 2007, 09:38 PM
#1
Thread Starter
Addicted Member
[2005] Update,Insert using SQLDataSource
I know how to do a select statement using SQLDatasource.SelectedCommand
I tried to insert using the same code , but , I'm not getting any thing inserted to the database and I'm not getting an error message
This is the code I'm using
Code:
Dim PRODUCT_ID, TRANS_TYPE, TRANS_STATUS As Integer
PRODUCT_ID = Me.GridView1.Rows(0).Cells(0).Text
TRANS_TYPE = 2
TRANS_STATUS = 1
Dim STR_FIELDS As String
Dim STR_VALUES As String
STR_FIELDS = "[PRODUCT_ID], [TRANS_TYPE], [TRANS_STATUS]"
STR_VALUES = "PRODUCT_ID, TRANS_TYPE, TRANS_STATUS"
Me.SqlDataSource2.SelectCommand = "INSERT INTO [TRANSACTIONS] (" & STR_FIELDS & ") VALUES (" & STR_VALUES & ")"
-
Jun 13th, 2007, 08:43 AM
#2
Re: [2005] Update,Insert using SQLDataSource
Look at this INSERT statement pulled directly from one of my apps. Should be fairly easy to figure out why yours isn't working.
Code:
InsertCommand="INSERT INTO [tblNewArrivals] ([intGunID], [bitActive], [dtPosted], [strPostedBy]) VALUES (@intGunID, @bitActive, @dtPosted, @strPostedBy)"
-
Jun 19th, 2007, 09:34 AM
#3
Re: [2005] Update,Insert using SQLDataSource
STR_VALUES = PRODUCT_ID.ToString() & "," & TRANS_TYPE.ToString() "," & "TRANS_STATUS"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|