Problem with response.redirect

Hi,
i m trying to pass a value from datagrid to a querystring as below...

Response.Redirect("review.aspx?id= " & e.Item.Cells(0).Text)

and also receiving the value as

cid = Request.QueryString("id")

but somehow the database query is not working with this id as i m trying like
Dim con As OleDbConnection
Dim cmd As OleDbCommand
Dim dr As OleDbDataReader
Try
con = New OleDbConnection(ConfigurationSettings.AppSettings("constring"))
con.Open()
cmd = New OleDbCommand("select cfname,clname from tblcust where cid = '" & cid & "'", con)
Response.Write(cmd.CommandText)
dr = cmd.ExecuteReader()
If dr.Read Then
Response.Write("its " & dr("cfname") & " " & dr("clname") & "'s review! ")
End If
con.Close()
dr.Close()

Catch ex As Exception
Response.Write(ex.Message)
con.Close()

End Try

but same database query is properly working if i send the querystring thru datanavigateurlformatstring as
DataNavigateUrlFormatString="review.aspx?id={0}"

from the aspx page

Pls tell me why the querystring coming from response.redirect is not working?
[1404 byte] By [swapcode] at [2007-11-19 18:39:55]
# 1 Re: Problem with response.redirect
Is CID a string? If not, you shouldn't need the enclosing ' marks.

Also, you should change this to use OleDB Parameters for two reasons:

1) You'll define the datatype automatically which would remove the formatting issue
2) You save yourself from a SQL injection attack.

You may want to make sure the cid value you're reading from the query string is not null in this case. It may be being called by a header row / etc.
mmetzger at 2007-11-9 11:49:16 >
# 2 Re: Problem with response.redirect
i m getting the value in the
response.write(request.querystring("id")

but still the query is not working ...
swapcode at 2007-11-9 11:50:18 >
# 3 Re: Problem with response.redirect
Have you tried removing the ' marks from around the entry? It depends on what the data type is.
mmetzger at 2007-11-9 11:51:17 >
# 4 Re: Problem with response.redirect
try sending the data as ..
Response.Redirect("review.aspx?id= ' " & e.Item.Cells(0).Text & " ' " )
hoe it will work
SmartBegginer at 2007-11-9 11:52:11 >
# 5 Re: Problem with response.redirect
hi all,
thanks for ur suggestions...
its working now as i hv stored e.item.cells(0).text in one string variable and then passed it thru response.redirect as

Dim id As String
id = e.Item.Cells(0).Text

Response.Redirect("review.aspx?id=" & id)

its ok now

thanks again! & happy coding. :-)
swapcode at 2007-11-9 11:53:20 >