Solved

ASP Connectionstring not working

Posted on 2014-03-05
4
157 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

743 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now