Minneslucka
New member
I can open and read from my database, but I cant write to it, what could be wrong with this code:
Dim MyConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Application.StartupPath & "/Allt I Allo.mdb;User ID=Admin;Mode=Share Deny None")
myConnection.Open()
Dim MyCommand As New OleDbCommand("INSERT INTO test (hej1, hej2) VALUES (hej3, hej4)", MyConnection)
MyCommand.CommandText = "SELECT @@IDENTITY"
MsgBox("Last ID was : " & MyCommand.ExecuteScalar())
MyConnection.Close()
MyCommand.Dispose()
Greetings /Ale
Dim MyConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Application.StartupPath & "/Allt I Allo.mdb;User ID=Admin;Mode=Share Deny None")
myConnection.Open()
Dim MyCommand As New OleDbCommand("INSERT INTO test (hej1, hej2) VALUES (hej3, hej4)", MyConnection)
MyCommand.CommandText = "SELECT @@IDENTITY"
MsgBox("Last ID was : " & MyCommand.ExecuteScalar())
MyConnection.Close()
MyCommand.Dispose()
Greetings /Ale