Results 1 to 3 of 3

Thread: [2005] Update,Insert using SQLDataSource

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2005
    Posts
    150

    [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 & ")"

  2. #2
    Banned timeshifter's Avatar
    Join Date
    Mar 2004
    Location
    at my desk
    Posts
    2,465

    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)"

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    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
  •  



Click Here to Expand Forum to Full Width