Results 1 to 17 of 17

Thread: Ado .net Insert Into [resolved]

Threaded View

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    Ado .net Insert Into [resolved]

    I have problems with the folowing code, and I don't know what's wrong with it...
    VB Code:
    1. Dim connString As String = "Provider=Microsoft.Jet.OLEDB.4.0;data source=" & Server.MapPath("ProjectDB.mdb") & ";"
    2. Dim cn As OleDbConnection
    3. cn = New OleDbConnection(connString)
    4. cn.Open()
    5.  
    6. Dim sql_ins As String = "INSERT INTO t_user (userid, username, password) VALUES (2, 'test', 'some password');"
    7. Dim cmd_ins As OleDbCommand
    8. cmd_ins = New OleDbCommand(sql_ins, cn)
    9. cmd_ins.ExecuteNonQuery()
    If I try to do select statements, it works fine, I can retreive the data, but it does not work for insert...
    Last edited by CVMichael; Mar 18th, 2003 at 04:52 PM.

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