Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: code snippet


Message #1 by dont worry <aspmailbox@y...> on Mon, 4 Nov 2002 14:30:03 -0800 (PST)
Need snippet to insert into access database and return
the NEW identity value for insert in index table. 

I have the following, but it doesnt work.
++++++++++++++++++++++++++++++++++++++++++++++

   Dim connstring as String
   connString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA
SOURCE="&Server.MapPath("\db\Database.mdb;")

   Dim objConnection as OleDbConnection
   objConnection = New OleDbConnection(connString)
   objConnection.Open()

   'Specify our SQL statement
   Dim strSQL as String = "Insert into QA (Question,
Answer) Values(a, b)"
   
  'Create the command object
   Dim objCommand as OleDbCommand
   objCommand = New OleDbCommand(strSQL,
objConnection)
   objCommand.ExecuteNonQuery(strSQL)


__________________________________________________
Do you Yahoo!?
HotJobs - Search new jobs daily now
http://hotjobs.yahoo.com/

  Return to Index