I'm trying to learn but, i need a kick to start on so if you can give me the code
it'll be a good kick for the start
Okey, thats the short discribe.
1. Create a connection to your database through DSN
+ Click on Start > Control Pannel > Administive Tools > Data Source (ODBC)
+ Select the tab System DSN and click Add
+ Scoll to the end of list and double click to SQL Server
+ Type Sample into Name textbox, and (local) to Server combobox (this will work if the SQL-Server was installed on your machine)
+ Click Next twice
+ Select the checkbox "Change the default database to". Choose your designed database from the combobox bellow and click Next. Then click Finish.
2. Goto visualbasic, create a new application
+ Select menu: Project > References
+ Check into Microsoft ActiveX Data Object 2.0 Library ( 2.0 or higher)
+ Create a new form with one textbox: Text1 and one command button Command1
+ Open the Code Designer, copy and paste bellow code into the form
-
Dim con As New ADODB.Connection
-
Dim sql As String
-
-
Private sub Form_Load()
-
con.Open "DSN=Sample"
-
End Sub
-
-
Private Sub Command1_Click()
-
sql = "INSERT INTO tableName(columnName) VALUES '" & Text1.Text & "'"
-
con.Excute sql
-
End Sub
-
-
Replace "tableName" with the name of the table that you want insert the data in
Replace "columnName" the the name of the field that will store the data.
The table from your database must have atleast one field (col) that named at tableName. (this field shouldnt be primarikey, and have datatype of Char or VarChar or NVarChar)
If you've known how to make the database from SQl-Server, so do like discribe above. If you have not, Save this reply for later use and learning how to make database first