•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 391,993 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,257 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 669 | Replies: 5
![]() |
•
•
Join Date: Dec 2004
Posts: 37
Reputation:
Rep Power: 4
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.
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.
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: 37
Reputation:
Rep Power: 4
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:
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: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
Location: Los Angeles, CA
Posts: 86
Reputation:
Rep Power: 4
Solved Threads: 2
Use store procedure with parametr @strSearch then pass a strSearch value through SQL parameter.value
Dexter Zaf
Ex-designz.net
Ex-designz.net
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb ASP.NET Marketplace
- 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#


Linear Mode