Solved

ASP Connectionstring not working

Posted on 2014-03-05
4
162 Views
Last Modified: 2014-03-06
I have this ASP Connection string for my MasterDetail Gridview but I keep getting an error that states that it's an incorrect syntax near '?'.  I'm using a session where clause to grab masterdetail information from the main gridview. Not sure where I can change or what i'm doing wrong. Thanks

SelectCommand="SELECT OrderDetailID, OrderID, ProductCode, SUBSTRING(ProductName, 5, LEN(ProductName)) AS ProductName, Quantity, ProductPrice, TotalPrice FROM OrderDetails WHERE ([OrderID] = ?)"

Open in new window

0
Comment
Question by:Southern_Gentleman
4 Comments
 
LVL 2

Expert Comment

by:gdarcan
ID: 39907843
Sorry but this is not a connection string. You may refer to connection strings at www.connectionstrings.com
0
 

Author Comment

by:Southern_Gentleman
ID: 39907944
It is the SelectCommand after my Connectionstring.  I'm still coming up with the error either or and my error is still the same.

<asp:SqlDataSource ID="sqlPrintedDetails" runat="server" ConnectionString="<%$ ConnectionStrings:ApplicationServices %>" SelectCommand="SELECT OrderDetailID, OrderID, ProductCode, SUBSTRING(ProductName, 5, LEN(ProductName)) AS ProductName, Quantity, ProductPrice, TotalPrice FROM OrderDetails WHERE ([OrderID] = ?)">

Open in new window

0
 
LVL 12

Accepted Solution

by:
jitendra patil earned 500 total points
ID: 39908742
try something like below.
cmd = new SQLCommand("SELECT OrderDetailID, OrderID, ProductCode, SUBSTRING(ProductName, 5, LEN(ProductName)) AS ProductName, Quantity, ProductPrice, TotalPrice FROM OrderDetails WHERE OrderID = @orderID)"", conn);
cmd.Parameters.AddWithValue("@orderID", value); //session value
cmd.Prepare();
cmd.executenonquery();

hope this helps.
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question