Results 1 to 2 of 2

Thread: Inserting row in database

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Denmark
    Posts
    1,049

    Question Inserting row in database

    I have some problems using ExecuteNonQuery. I receive an error saying "Operation must an updatetable query". I have changed the Folder options to
    Tools | Folder Options | View and uncheck "Use Simple File Sharing (Recommended)" at the bottom.

    I can't make it work, here's my code.

    Code:
    sub insertKunde(sender as object, e as eventArgs)
    	'Her bruger jeg direkte SQL-kommandoer til at indsætte i databasen
    	
    	Dim objConnection as OleDbConnection
    	Dim objCommand as OleDbCommand
    	Dim strSql as string
    
    	Dim strCn as String ="Provider=Microsoft.jet.oledb.4.0;"
    	strCn += "Data Source=" & server.mappath("autohuset.MDB") & ";"
    	
    	'Her åbner jeg en connection
    	objConnection = New OleDbConnection(strCn)
    	objConnection.open()
    	
    	strSql = "INSERT INTO kunde ('kundenr','navn','adresse','postnr','telefonnr','e-mail' )" & _
    		 " VALUES ('12','Hans Peter','Ny vej 12','9000','99661565','[email protected]' )"
    
    	objCommand = New OleDbCommand(strSql, objConnection)
    	objCommand.ExecuteNonQuery()
    end sub

  2. #2

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Denmark
    Posts
    1,049

    Cool

    I've found out, I changed the properties on the current folder, then everything worked properly.

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