hi,
i have a project in my last year and have 2 queries
i am using vb.net and sql server 2005 as backend
first problem is, i have a search form in which a field called billno is searched and all details are displayed in datagridview but the problem is i have to restart the project every now and then.whenever any entry is done in database the immediate form opens is the search form so it must display the data which was inserted immediately without restarting the project.
for inserting data i am using the following code :
f TextBox1.Text = "" Or TextBox2.Text = "" Or TextBox3.Text = "" Or TextBox7.Text = "" Or TextBox11.Text = "" Or TextBox12.Text = "" Or TextBox13.Text = "" Or DateTimePicker1.Text = "" Then
ErrorProvider1.SetError(TextBox1, "Enter Proper Details")
ErrorProvider2.SetError(TextBox2, "Enter Proper Details")
ErrorProvider3.SetError(TextBox3, "Enter Proper Details")
ErrorProvider4.SetError(TextBox7, "Enter Proper Details")
ErrorProvider5.SetError(TextBox11, "Enter Proper Details")
ErrorProvider7.SetError(TextBox12, "Enter Proper Details")
ErrorProvider8.SetError(TextBox13, "Enter Proper Details")
ErrorProvider9.SetError(DateTimePicker1, "Enter Proper Details")
Else
Dim constr As String
constr = "Data Source=.\SQLEXPRESS;AttachDbFilename=I:\Samsung_service\TestSamsung\TestSamsung\Test.mdf;Integrated Security=True;User Instance=True"
Dim conn As New SqlConnection(constr)
Try
conn.Open()
Dim query As String
query = "select * from Customers"
Dim da As New SqlDataAdapter(query, conn)
Dim ds As Data.DataSet = New Data.DataSet("Customers")
da.Fill(ds, "Customers")
Dim table As New Data.DataTable
table = ds.Tables("Customers")
Dim newrow As Data.DataRow
newrow = table.NewRow()
newrow("bill_no") = TextBox1.Text
newrow("cust_name") = TextBox2.Text
newrow("addr") = TextBox3.Text
'newrow("telephone1") = TextBox4.Text
'newrow("t2") = TextBox5.Text
newrow("t3") = TextBox6.Text
newrow("model_name") = TextBox7.Text
newrow("serial_no_SN") = TextBox8.Text
newrow("s2_ESN") = TextBox9.Text
newrow("s3_IMEI") = TextBox10.Text
newrow("pur_date") = DateTimePicker1.Text
newrow("defect_descrpn") = TextBox11.Text
newrow("accessory") = TextBox12.Text
newrow("remark") = TextBox13.Text
table.Rows.Add(newrow)
Dim builder As New SqlCommandBuilder(da)
da.InsertCommand = builder.GetInsertCommand()
da.Update(ds, "Customers")
ds.Clear()
da.Fill(ds, "Customers")
table = ds.Tables("Customers")
MsgBox("Data Has Been Saved Successfully....")
Catch ex As Exception
' MsgBox(ex.Message)
MsgBox("Check Details Entered. ")
Finally
conn.Close()
End Try
'Form3.Show()
End If
If TextBox6.Text = "" Then
ErrorProvider6.SetError(TextBox6, "Compulsoy Field")
End If
End Sub
second problem is have a print form in a particular format but the data retrieval in textboxes is not happening actally i dont know what to do.
haven't written any code yet
what whould e the code for data retrieval from database into their respective textboxes?
HELP PLZZZ....