Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

passing a variable from asp to asp.net

0 views
Skip to first unread message

Vincent Jones

unread,
Feb 20, 2004, 4:59:26 PM2/20/04
to
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=;database=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

Kirk Graves

unread,
Feb 20, 2004, 5:42:30 PM2/20/04
to
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" <vnc...@hotmail.com> wrote in message
news:ba2a2d30.04022...@posting.google.com...

Emanuel

unread,
Feb 20, 2004, 5:56:08 PM2/20/04
to
Try this

SqlConnection myConnection = new SqlConnection("server=111.111.111.111;uid=;pwd=;database=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);

0 new messages