"Krij" <gs***@start.nowrote in message
news:11**********************@38g2000cwa.googlegro ups.com...
Can anybody tell me about this:
conn.ConnectionString = "SELECT [Customernr], [Customername],
[OrderID], [Orderdate], [Itemname], [Ordersum], [Orderdiscount],
[Orderprice], [Orderamount] " + "\n" +
"WHERE Customernr = "' + <%txtCustnr.Text %+ '" FROM
[CustomerOrderHistory] ORDER BY [Orderdate]";
So what I try to obtain is getting a value from a textbox: txtCustnr.
The code is C# in an ASP 2.0 application
But this syntax drives me mad.
Any tip?
You should try a dotnet group rather than this one, which deals with classic
asp. The busiest ones are microsoft.public.dotnet.framework.aspnet, or the
forums at
www.asp.net. I suggest that future asp.net related questions are
posted there, because you will likely get a much quicker response.
However, the reason that the syntax is driving you mad is because you are
trying to assign a (badly formed) SQL statement to the ConnectionString
property. In fact, the SQL statement should be the CommandText.
There are a number of ways of approaching what you want to achieve. But, I
suggest that if you haven't already done so, you download a copy of
Microsoft Visual Web Developer, which is free, and use the wizards to
configure a DataSource, which will prompt you for the source of any
parameters that you want to feed into the query. In your case, the source
will be a control, txtCustomer. It will also help you to construct a SQL
statement properly.
--
Mike Brind