View Single Post
  #2 (permalink)  
Old June 22nd, 2009, 04:56 PM
liamfitz liamfitz is offline
Authorized User
Points: 211, Level: 4
Points: 211, Level: 4 Points: 211, Level: 4 Points: 211, Level: 4
Activity: 12%
Activity: 12% Activity: 12% Activity: 12%
 
Join Date: Jun 2006
Location: Orpington, Kent, United Kingdom.
Posts: 51
Thanks: 1
Thanked 1 Time in 1 Post
Lightbulb This may help ...

PublicClass frmUpdate
PrivateConst CONNECT_STRING AsString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Databases\bm2009.mdb; Persist Security Info=False"
----------------------------------------------------------------------------------------------
Private
Sub Button1_Click(ByVal sender AsObject, ByVal e As System.EventArgs) Handles Button1.Click
' open the connection.
Dim conn_times24 AsNew OleDb.OleDbConnection(CONNECT_STRING)
conn_times24.Open()
' make a command to insert the data
Dim cmd AsNew OleDb.OleDbCommand("INSERT INTO 24hrTimes (Time_Number) VALUES (?)", conn_times24)
Dim x As Byte
x=1
' add the number 1 to Time_Number field
cmd.Parameters.Add(New OleDb.OleDbParameter("Time_Number", x))
' execute the command.
Try
cmd.ExecuteNonQuery()
Catch ex As Exception
MessageBox.Show(ex.Message)
EndTry
conn_times24.Close()
conn_times24.Dispose()
lblOP.Text =
" Done ! "
EndSub
-------------------------------------------------------------------------------------------------------------
EndClass

In this I've opened a database using a connectioin string ( obviously substitute in your code, the appropriate file path & D.B. name.) Then inserted a value of 1 into the named field ' Time_Number'. You will need to check the syntax for deletion, and updating, but this is the format that V.B. 2008, expects the S.Q.L. to be in programmatically.
Reply With Quote