|
-
July 22nd, 2009, 05:57 AM
#1
fill form fields
I am working on Visualbasic -2008 express edition and mysql as database.I am able to establish the connection with database table.I am strucked in how to fill the form fields and datgrid..I have date,partno,quotes,customer fields on a form.Have a look at the connection
help me to fill the form fields and datagrid
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
cn = New ADODB.Connection
rs = New ADODB.Recordset
cn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" + "SERVER=localhost;" + "DATABASE=in_out;" + "UID=root;" + "PASSWORD=pacvision;" + "dsn=in_out:" + "OPTION=3;"
'cn.ConnectionString = Cnstr
cn.Open()
MessageBox.Show("Connection Opened Successfully")
rs.Open("Select * from deptno", cn.ConnectionString, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic)
-
July 22nd, 2009, 01:40 PM
#2
Re: fill form fields
In .NET you don't use ADODB, you should rather use MySQL Connector. If you search for MySql Connector in google, you will lot of samples too. Take a look at those samples and see if they will help you.
-
July 24th, 2009, 04:45 AM
#3
Re: fill form fields
 Originally Posted by Shuja Ali
In .NET you don't use ADODB, you should rather use MySQL Connector. If you search for MySql Connector in google, you will lot of samples too. Take a look at those samples and see if they will help you.
Ali,apreciable to you suggestion.I used MySql Connector and completed the task.
I have one question to you,I am adding values to database from form fields using insert Query but the quey is not executing.have a look at the query
Console.WriteLine(updateRecord("insert into quotes(date,PartNo,Customer)values('" + txtDate.Text + "','" + txtpartnumber.Text + "','" + txtCustomer.Text + "')"))
I am using VB2008 environment
-
July 24th, 2009, 08:14 PM
#4
Re: fill form fields
Don't use reserved words in queries or field names. Date is.
Also, dates aren't STRING, or TEXT. You need to convert to a valid date, so always check values before adding them to your tables
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|