| | |
How to make this SQL SELECT statement work in ASP.NET
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Dec 2004
Posts: 38
Reputation:
Solved Threads: 0
Can someone help me convert this SQL SELECT statement to ASP.NET code (if possible):
I'm trying to use it as a SelectCommand.
ASP.NET Syntax (Toggle Plain Text)
SELECT * FROM tblCategory RIGHT JOIN tblInventory ON tblCategory.categoryID = tblInventory.categoryID WHERE (((tblInventory.type)=[strSearch])) OR (((tblInventory.country)=[strSearch])) OR (((tblInventory.date)=[strSearch])) OR (((tblInventory.eventSeries)=[strSearch])) OR (((tblInventory.grade)=[strSearch])) OR (((tblInventory.comment)=[strSearch]));
I'm trying to use it as a SelectCommand.
ASP.NET Syntax (Toggle Plain Text)
Dim conn1 as new data.sqlclient.sqlconnection(CONNECTIONSTRING) Dim Select_String as String = WHAT YOU JUST WROTE Dim Select_Adapter as new data.sqlclient.sqldataadapter(Select_String,conn1) Dim YourDataSet as New Data.Dataset conn1.open Select_Adapter.Fill(YourDataSet) conn1.close
There are free converters to C# if you need.
--
"Dummy."
"Dummy."
•
•
Join Date: Dec 2004
Posts: 38
Reputation:
Solved Threads: 0
Thanks for the reply. What I'm actually trying to do is to get it to bind to a GridView and set strSearch equal to a QueryString @search.
So in my Page_Load, I have:
Then I have an AccessDataSource defined in my aspx file, and this is what I currently have:
So if I try to pass a variable onto this page using frmSearch.aspx?@search=Lincoln for example, then I get a "No value given for one or more required parameters" error.
Any help? Sorry I didn't provide more detail earlier.
So in my Page_Load, I have:
ASP.NET Syntax (Toggle Plain Text)
Dim strSearch As String = Request.QueryString("@search")
Then I have an AccessDataSource defined in my aspx file, and this is what I currently have:
ASP.NET Syntax (Toggle Plain Text)
<asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/coindata.mdb" SelectCommand="SELECT * FROM tblCategory RIGHT JOIN tblInventory ON tblCategory.categoryID = tblInventory.categoryID WHERE (((tblInventory.type)=[strSearch])) OR (((tblInventory.country)=[strSearch])) OR (((tblInventory.date)=[strSearch])) OR (((tblInventory.eventSeries)=[strSearch])) OR (((tblInventory.grade)=[strSearch])) OR (((tblInventory.comment)=[strSearch]));"> </asp:AccessDataSource>
So if I try to pass a variable onto this page using frmSearch.aspx?@search=Lincoln for example, then I get a "No value given for one or more required parameters" error.
Any help? Sorry I didn't provide more detail earlier.
•
•
Join Date: Feb 2005
Posts: 86
Reputation:
Solved Threads: 3
Use store procedure with parametr @strSearch then pass a strSearch value through SQL parameter.value
Dexter Zaf
Ex-designz.net
Ex-designz.net
![]() |
Similar Threads
- SQL String question (ASP)
- SQL Query, need major help! (MySQL)
- ASP.NET and SQL problem: (ASP.NET)
- need help (VB.NET)
- ASP.net/Stored Proc & Login Verification (ASP.NET)
Other Threads in the ASP.NET Forum
- Previous Thread: im a begginer
- Next Thread: create shopping cart website using asp.net and c#
Views: 3525 | Replies: 5
| Thread Tools | Search this Thread |
Tag cloud for ASP.NET
.net 2.0 3.5 activexcontrol advice ajax asp asp.net bc30451 bottomasp.net browser businesslogiclayer button c# c#gridviewcolumn checkbox child class click compatible confirmationcodegeneration content contenttype control countryselector courier css database datagrid datagridview datagridviewcheckbox datalist deadlock development dgv dropdown dropdownmenu dynamic edit feedback findcontrol flash flv folder form forms google grid gridview homeedition hosting iframe iis index javascript jquery list maps menu mono mssql multistepregistration nameisnotdeclared object objects order problem profile ratings refer rotatepage save search security serializesmo.table session silverlight smartcard sql suse textbox tracking typeof unauthorized update validation vb.net video view virtualdirectory vista visual-studio visualstudio vs2008 web webarchitecture webdevelopemnt webdevelopment wizard xml





