Hi I used the Data Source Configuration Wizard to connect to my access database, how do I write code to manipulate the data from the database? I read the book "Microsoft Visual Basic 208 step by step", it only teaches how to display data on the form. So how do I write the code so that I can input data and search if the database has this data at runtime?
This is my code. when I run it. there is nothing happen in my database1.mdb Could you please tell me the problem?
'build access database connection
Dim Conn As New OleDbConnection("provider = microsoft.jet.oledb.4.0;data source = D:\access\Database1.mdb;User ID = Admin;Password =;Persist Security Info = false")
'insert query and select query, in this case I don't know if select query is needed, but visual studio return errors when I do fill dataset without the select command
Dim insertSQl As String = "INSERT INTO tbl1(User, password) values (Dave, 123456)"
Dim selectSQL As String = "SELECT * from tbl1"
Dim adapter As New OleDbDataAdapter()
Dim selectcmd As New OleDbCommand(selectSQL, Conn)
adapter.SelectCommand = selectcmd
Dim insertcmd As New OleDbCommand(insertSQl, Conn)
adapter.InsertCommand = insertcmd
'I don't know what the parameters do in the code
insertcmd.Parameters.Add("@User", OleDbType.VarChar, 30).Value = "Dave"
insertcmd.Parameters.Add("@password", OleDbType.VarChar, 30).Value = "123456"
Dim User As New DataSet
Dim password As New DataSet
You are struggling with programming. Keep one thing in mind, we will help you in case you have a little problem. We will try out best but my suggestion to you that - Don't waste your time. Get some books - Database, .net framework, VB.NET language (OOP. .NET programming requires fundamental knowledge of Object-Oriented paradigm.
I found the problem. it is somehow the insert statement. it seems that I can't put specific columns that I want to insert data in, in the insert query... I then change it to "INSERT INTO tbl1 VALUES (?, ?)" it works now.
You can try to use timer control. grab a label and a timer control from the toolbox. double click on the timer control and go into the coding environment. type in label1.text = timestring
you can also try system.datetime.now method as well
you need to type in label1.text = system.datetime.now
Hope this helps