Hi all,
i tried co retrieve value from database.
My code is like this:

Dim OLEConn As OleDbConnection
Dim sqlConn As SqlConnection
Dim OLE_DA As OleDbDataAdapter
Dim sql_DA As SqlDataAdapter
Dim OLE_DR As OleDbDataReader
Dim sql_DR As SqlDataReader
Dim OLE_Comm As OleDbCommand
Dim sql_Comm As SqlCommand
Dim OLE_DS As DataSet
Dim sql_DS As DataSet

Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSubmit.Click
Dim RecCount As Integer
OLEConn = New OleDbConnection("Provider=SQLOLEDB.1;Password=;Persist
Security Info=True;User ID=sa;Initial Catalog=AutoQplex;Data
Source=localhost")
OLE_Comm = New OleDbCommand("select count(flight_idx) from mflight
where flightno='" &
ddlFlightNo.Items.Item(ddlFlightNo.SelectedIndex).Text & "' and route
='" & ddlRoute.Items.Item(ddlRoute.SelectedIndex).Text & "'", OLEConn)
OLEConn.Open()
OLE_DA = New OleDbDataAdapter("select count(flight_idx) from mflight
where flightno='" &
ddlFlightNo.Items.Item(ddlFlightNo.SelectedIndex).Text & "' and route
='" & ddlRoute.Items.Item(ddlRoute.SelectedIndex).Text & "'", OLEConn)
OLE_DA.Fill(OLE_DS, "mflightno")

RecCount = OLE_DS.Tables("mflight").Rows.Count
If RecCount = 0 Then
   msgBox("No Flight Number and Route", MsgBoxStyle.Information)
End If
End Sub

but on OLE_DA.Fill(OLE_DS, "mflightno") error occured (Value cannot be
null)

i have tried to run SQL string in sql server and it return 0
(select count(flight_idx)....)

can you tell me why this error occured and how to fix it ?

thx








------------------------ Yahoo! Groups Sponsor --------------------~--> 
1.2 million kids a year are victims of human trafficking. Stop slavery.
http://us.click.yahoo.com/WpTY2A/izNLAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to