Solved

ASP Connectionstring not working

Posted on 2014-03-05
4
174 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 13

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

632 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