6
Answers

problem with sql statment

Photo of microuser

microuser

19y
3.4k
1
hellow to all i am new to vb.net and i am working with data base i try to run the next code Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim sql As String sql = "select Customer.Customer from Customer Where Customer.Customer ID = 1" Dim objconn As New OleDb.OleDbConnection(sConnection) Dim objdataadapter As New OleDb.OleDbDataAdapter(sql, objconn) Dim objds As New DataSet("Customer") Dim objdv As DataView Dim objtabel As DataTable Try objconn.Open() Catch ex As Exception Windows.Forms.MessageBox.Show(ex.Message) End Try If objconn.State = ConnectionState.Open Then Try objdataadapter.Fill(objds, "Customer") objconn.Close() objtabel = objds.Tables("Customer") objdv = objtabel.DefaultView TextBox2.DataBindings.Add("text", objdv, "Customer") Catch ex As Exception Windows.Forms.MessageBox.Show(ex.Message) End Try End If End Sub and when i run it i get a wrong message .. i had cheaked the database i have all the tabels and the customer ID thxx for the help

Answers (6)

0
Photo of Anshuman Sharma
NA 116 406 10y
use this code in your mainform 


popupForm frm = new 
popupForm ();
frm.showdialog();

textbox1.text=frm.value;

Accepted
0
Photo of Munesh Sharma
NA 17.1k 2.4m 10y
thank you anshuman it is working 
0
Photo of Munesh Sharma
NA 17.1k 2.4m 10y
yes anshuman it is a new form
0
Photo of Anshuman Sharma
NA 116 406 10y
What is the mean by popup window..??


is it a new form.?