i have add the code to create the dataset OLE_DS = New DataSet() OLE_DA.Fill(OLE_DS, "mflightno")
but the another error occured : "Object reference not set to an instance of an object." can you tell me what it is ? sorry asking you with a lot of questions, coz i am a newbie in ASP.NET thx --- In [email protected], Dean Fiala <[EMAIL PROTECTED]> wrote: > > You need to create the DataSet before filling it. > > OLE_DS = New DataSet() > OLE_DA.Fill(OLE_DS, "mflightno") > > > On 11/28/05, Real_Guy <[EMAIL PROTECTED]> wrote: > > 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 Links > > > > > > > > > > > > > > > > > -- > Dean Fiala > Very Practical Software, Inc > http://www.vpsw.com > ------------------------ Yahoo! Groups Sponsor --------------------~--> Fair play? Video games influencing politics. Click and talk back! http://us.click.yahoo.com/u8TY5A/tzNLAA/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/
