suryatiakz
Member
- Joined
- Oct 2, 2010
- Messages
- 7
- Programming Experience
- Beginner
this is my senario
i am choosing a flight that i want and then the system will go tho another form where it will show the details about the flight in datagridview..after we choose which flight to take there is 2 combobox where u can choose hw many adult and hw many child...at last there is a calculate button where it calculate the total price...the peradult price n perchild price will b stated at datagridview....the total price calculated will b displayed in a textbox....plsssss help me in this coding...i rely needed urgently...
this is my coding
Dim adult As Double
Dim child As Double
myconnection = New OleDb.OleDbConnection(myconnectionstring)
myconnection.Open()
ocmd = New OleDb.OleDbCommand("SELECT peradult,perchild FROM flight WHERE flightid = '" & TextBox1.Text & "'", myconnection)
odr = ocmd.ExecuteReader
odr.Read()
If odr.HasRows Then
ocmd = New OleDbCommand("select * from flight where peradult = ('" & TextBox1.Text & "')", myconnection)
ra = New OleDbDataAdapter(ocmd)
ds = New DataSet()
ra.Fill(ds, "flight")
DataGridView1.DataSource = ds.DefaultViewManager
DataGridView1.DataMember = "flight"
DataGridView1.Refresh()
Else
MessageBox.Show(" ID doesn't exist!")
End If
adult = combobx_adult.Text
child = combobx_child.Text
ttlprice.Text = (odr("peradult") * adult) + (odr("perchild") * child)
End Sub
i am choosing a flight that i want and then the system will go tho another form where it will show the details about the flight in datagridview..after we choose which flight to take there is 2 combobox where u can choose hw many adult and hw many child...at last there is a calculate button where it calculate the total price...the peradult price n perchild price will b stated at datagridview....the total price calculated will b displayed in a textbox....plsssss help me in this coding...i rely needed urgently...
this is my coding
Dim adult As Double
Dim child As Double
myconnection = New OleDb.OleDbConnection(myconnectionstring)
myconnection.Open()
ocmd = New OleDb.OleDbCommand("SELECT peradult,perchild FROM flight WHERE flightid = '" & TextBox1.Text & "'", myconnection)
odr = ocmd.ExecuteReader
odr.Read()
If odr.HasRows Then
ocmd = New OleDbCommand("select * from flight where peradult = ('" & TextBox1.Text & "')", myconnection)
ra = New OleDbDataAdapter(ocmd)
ds = New DataSet()
ra.Fill(ds, "flight")
DataGridView1.DataSource = ds.DefaultViewManager
DataGridView1.DataMember = "flight"
DataGridView1.Refresh()
Else
MessageBox.Show(" ID doesn't exist!")
End If
adult = combobx_adult.Text
child = combobx_child.Text
ttlprice.Text = (odr("peradult") * adult) + (odr("perchild") * child)
End Sub