473,394 Members | 1,778 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

passing a variable from asp to asp.net

in index.asp, i'm passing the this variable:
<a href="Description.aspx?Painting=<%=RS2("Painting") %>">Painting</a>

void Page_Load(Object sender, EventArgs e)
{
SqlConnection myConnection = new
SqlConnection("server=111.111.111.111;uid=;pwd=;da tabase=mdMuseumStore");
SqlDataAdapter myCommand = new SqlDataAdapter("Select Painting,
Artist, Title, Description from tbManetPaintings Where Painting =
'"Request.QueryString["Painting"]"'", myConnection);
DataSet ds = new DataSet();
myCommand.Fill(ds, "tbManetPaintings");
MyRepeater.DataSource =
ds.Tables["tbManetPaintings"].DefaultView;
MyRepeater.DataBind();
}

I always get
CS1026: ) expected
Nov 15 '05 #1
4 1653
You have a simple concatenation error...
Make a very small change.
------------------------
SqlDataAdapter myCommand = new SqlDataAdapter("Select Painting,"
+ " Artist, Title, Description from tbManetPaintings Where Painting = '"
+ Request.QueryString["Painting"] + "'", myConnection);
------------------------
or, even better, use a command and parameter (easier to read, safer)
------------------------
SqlCommand cmd = new SqlCommand("Select Painting,"
+ " Artist, Title, Description from tbManetPaintings Where Painting =
@Painting", myConnection);
cmd.Parameters.Add("@Painting",Request.QueryString["Painting"]);
SqlDataAdapter myCommand = new SqlDataAdapter(cmd);
--------------------------

Kirk Graves
KRGIT Software

"Vincent Jones" <vn****@hotmail.com> wrote in message
news:ba**************************@posting.google.c om...
in index.asp, i'm passing the this variable:
<a href="Description.aspx?Painting=<%=RS2("Painting") %>">Painting</a>

void Page_Load(Object sender, EventArgs e)
{
SqlConnection myConnection = new
SqlConnection("server=111.111.111.111;uid=;pwd=;da tabase=mdMuseumStore");
SqlDataAdapter myCommand = new SqlDataAdapter("Select Painting,
Artist, Title, Description from tbManetPaintings Where Painting =
'"Request.QueryString["Painting"]"'", myConnection);
DataSet ds = new DataSet();
myCommand.Fill(ds, "tbManetPaintings");
MyRepeater.DataSource =
ds.Tables["tbManetPaintings"].DefaultView;
MyRepeater.DataBind();
}

I always get
CS1026: ) expected

Nov 15 '05 #2
You have a simple concatenation error...
Make a very small change.
------------------------
SqlDataAdapter myCommand = new SqlDataAdapter("Select Painting,"
+ " Artist, Title, Description from tbManetPaintings Where Painting = '"
+ Request.QueryString["Painting"] + "'", myConnection);
------------------------
or, even better, use a command and parameter (easier to read, safer)
------------------------
SqlCommand cmd = new SqlCommand("Select Painting,"
+ " Artist, Title, Description from tbManetPaintings Where Painting =
@Painting", myConnection);
cmd.Parameters.Add("@Painting",Request.QueryString["Painting"]);
SqlDataAdapter myCommand = new SqlDataAdapter(cmd);
--------------------------

Kirk Graves
KRGIT Software

"Vincent Jones" <vn****@hotmail.com> wrote in message
news:ba**************************@posting.google.c om...
in index.asp, i'm passing the this variable:
<a href="Description.aspx?Painting=<%=RS2("Painting") %>">Painting</a>

void Page_Load(Object sender, EventArgs e)
{
SqlConnection myConnection = new
SqlConnection("server=111.111.111.111;uid=;pwd=;da tabase=mdMuseumStore");
SqlDataAdapter myCommand = new SqlDataAdapter("Select Painting,
Artist, Title, Description from tbManetPaintings Where Painting =
'"Request.QueryString["Painting"]"'", myConnection);
DataSet ds = new DataSet();
myCommand.Fill(ds, "tbManetPaintings");
MyRepeater.DataSource =
ds.Tables["tbManetPaintings"].DefaultView;
MyRepeater.DataBind();
}

I always get
CS1026: ) expected

Nov 15 '05 #3
Try thi

SqlConnection myConnection = new SqlConnection("server=111.111.111.111;uid=;pwd=;da tabase=mdMuseumStore")
HttpRequest hr = new HttpRequest("1", "2", "3")
SqlDataAdapter myCommand = new SqlDataAdapter
"Select Painting, Artist, Title, Description from tbManetPaintings Where Painting ='" + hr.QueryString["Painting"] + "'", myConnection)
DataSet ds = new DataSet()
myCommand.Fill(ds, "tbManetPaintings")
MyRepeater.DataSource = ds.Tables["tbManetPaintings"].DefaultView
MyRepeater.DataBind();

Nov 15 '05 #4
Try thi

SqlConnection myConnection = new SqlConnection("server=111.111.111.111;uid=;pwd=;da tabase=mdMuseumStore")
HttpRequest hr = new HttpRequest("1", "2", "3")
SqlDataAdapter myCommand = new SqlDataAdapter
"Select Painting, Artist, Title, Description from tbManetPaintings Where Painting ='" + hr.QueryString["Painting"] + "'", myConnection)
DataSet ds = new DataSet()
myCommand.Fill(ds, "tbManetPaintings")
MyRepeater.DataSource = ds.Tables["tbManetPaintings"].DefaultView
MyRepeater.DataBind();

Nov 15 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) {...
58
by: jr | last post by:
Sorry for this very dumb question, but I've clearly got a long way to go! Can someone please help me pass an array into a function. Here's a starting point. void TheMainFunc() { // Body of...
39
by: Mike MacSween | last post by:
Just spent a happy 10 mins trying to understand a function I wrote sometime ago. Then remembered that arguments are passed by reference, by default. Does the fact that this slowed me down...
6
by: Scott Zabolotzky | last post by:
I'm trying to pass a custom object back and forth between forms. This custom object is pulled into the app using an external reference to an assembly DLL that was given to me by a co-worker. A...
11
by: John Pass | last post by:
Hi, In the attached example, I do understand that the references are not changed if an array is passed by Val. What I do not understand is the result of line 99 (If one can find this by line...
6
by: MSDNAndi | last post by:
Hi, I get the following warning: "Possibly incorrect assignment to local 'oLockObject' which is the argument to a using or lock statement. The Dispose call or unlocking will happen on the...
12
by: Andrew Bullock | last post by:
Hi, I have two classes, A and B, B takes an A as an argument in its constructor: A a1 = new A(); B b = new B(a1);
3
by: James Robertson | last post by:
I am new to the ASP and VB thing so be kind. Question I have is that I have created an ASPX web site to use as an E-Mail page. But I want to use this for a lot of users. Can I create the link on...
3
by: DaTurk | last post by:
If I call this method, and pass it a byte by ref, and initialize another byte array, set the original equal to it, and then null the reference, why is the original byte array not null as well? I...
11
by: =?Utf-8?B?U3VqZWV0?= | last post by:
If there are long strings (like 1MB or 2MB) is it more performant to pass those by ref to methods or by value?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.