ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #16  
Old September 23rd, 2003, 02:10 PM
plasmagrid plasmagrid is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 2 plasmagrid User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #17  
Old September 23rd, 2003, 02:16 PM
plasmagrid plasmagrid is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 2 plasmagrid User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #18  
Old September 23rd, 2003, 06:17 PM
mohecan mohecan is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: Melbourne, Australia
Posts: 212 mohecan User rank is Private First Class (20 - 50 Reputation Level)mohecan User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
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?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > Searching Database using ASP


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT