|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#16
|
|||
|
|||
|
Seaching access database
Mohecan,
You info was interesting, I added the % signs and i still can't. I get the following error Command text was not set for the command object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.OleDb.OleDbException: Command text was not set for the command object. Source Error: Line 47: Adapter.SelectCommand = new OleDbCommand(SelectStatement, Connect) Line 48: Adapter.SelectCommand.Connection.Open Line 49: Adapter.Fill(NumbersDS,"TblModNum") Line 50: NumGrid.DataSource = NumbersDS.Tables("TblModNum") Line 51: Page.DataBind MY CODE IS AS FOLLOWS : <script runat="server"> Sub Search_Click(Sender As Object, E As EventArgs) Dim Connect As OleDbConnection = New OleDbConnection Dim Adapter As OleDbDataAdapter = New OleDbDataAdapter Dim NumbersDS As DataSet = New DataSet Dim ConnectString, SelectStatement As String If Unit.Text = "" Then Message.Text = "You didn't enter a search criteria . Try again." Else if Unit.Text <> "" Then SelectStatement = "Select * From TblModNum Where Unit_Number= '" & Unit.Text & "'" Else if Main.Text = "" Then Message.Text = "You didn't enter a search criteria . Try again." Else if Main.Text <> "" Then SelectStatement = "Select * From TblModNum Where Main_Phone= '" & Main.Text & "'" Else if Hub.Text = "" Then Message.Text = "You didn't enter a search criteria . Try again." Else if Hub.Text <> "" Then SelectStatement = "Select * From TblModNum Where Hub_Phone= '" & Hub.Text & "'" Else if Modem.Text = "" Then Message.Text = "You didn't enter a search criteria . Try again." Else if Modem.Text <> "" Then SelectStatement = "Select * From TblModNum Where Modem_Phone= '" & Modem.Text & "'" Else if Inbound.Text = "" Then Message.Text = "You didn't enter a search criteria . Try again." Else if Inbound.Text <> "" Then SelectStatement = "Select * From TblModNum Where Inbound_Line= '" & Inbound.Text & "'" Else if Outbound.Text = "" Then Message.Text = "You didn't enter a search criteria . Try again." Else if Outbound.Text <> "" Then SelectStatement = "Select * From TblModNum Where Outbound_Line LIKE '%" & Outbound.Text & "%'" End If ConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=c:\inetpub\wwwroot\tester\ModNum.mdb" Connect.ConnectionString = ConnectString Adapter.SelectCommand = new OleDbCommand(SelectStatement, Connect) Adapter.SelectCommand.Connection.Open Adapter.Fill(NumbersDS,"TblModNum") NumGrid.DataSource = NumbersDS.Tables("TblModNum") Page.DataBind End Sub </script> Source File: c:\inetpub\wwwroot\tester\ModNumPick.aspx Line: 49 |
|
#17
|
|||
|
|||
|
Other part of info
Command text was not set for the command object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.OleDb.OleDbException: Command text was not set for the command object. Source Error: Line 47: Adapter.SelectCommand = new OleDbCommand(SelectStatement, Connect) Line 48: Adapter.SelectCommand.Connection.Open Line 49: Adapter.Fill(NumbersDS,"TblModNum") Line 50: NumGrid.DataSource = NumbersDS.Tables("TblModNum") Line 51: Page.DataBind Source File: c:\inetpub\wwwroot\tester\ModNumPick.aspx Line: 49 |
|
#18
|
|||
|
|||
|
I'm curious as to why you would be using OLE to connect to your db, why not ODBC?
Having said this, I did find this page on the MS KB - http://support.microsoft.com/defaul...278&Product=asp
__________________
How can I soar like an eagle when I'm flying with turkey's? |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > Searching Database using ASP |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|