2uzhan.com
Advertisement
Now Place:2uzhan.com » fill form fields

fill form fields

Visual Basic .NET @ July 20, 2009   Views:0

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)

--------------Solutions-------------

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

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

Tags:
© 2018 2uzhan.com Contact