Author |
Topic |
akpaga
Constraint Violating Yak Guru
331 Posts |
Posted - 2008-08-13 : 10:54:22
|
My name field contains an & in the name like A&B company.When i try to pull up this name field on front end via a query string and datareader no info is showing up.What could be the problem? |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-08-13 : 11:02:47
|
How are you "pulling" the record?Are you sure "&" is not treated as a keyboard shortcut? E 12°55'05.25"N 56°04'39.16" |
 |
|
akpaga
Constraint Violating Yak Guru
331 Posts |
Posted - 2008-08-13 : 11:08:08
|
Thanks for reply i did not understand what you say? I use a stored procedure with a parameter "@name" and i provide the value for that with querystring from the front end to fill the datareader. |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-08-13 : 11:10:28
|
In .Net "&" is a string concatenator.Please post full code used so we can have a look. E 12°55'05.25"N 56°04'39.16" |
 |
|
akpaga
Constraint Violating Yak Guru
331 Posts |
Posted - 2008-08-13 : 11:22:30
|
Dim command As New SqlCommand("customerlist", conn) Command.CommandType = CommandType.StoredProcedure command.Parameters.AddWithValue("@company_name", SqlDbType.Char).Value = Request.QueryString("name") Dim dr1 As SqlDataReader = command.ExecuteReader() If dr1.Read Then txtcompany.Text = dr1("company_name") & "" txtaddr1.Text = dr1("vnd_addr1") & "" txtaddr2.Text = dr1("vnd_addr2") & "" txtcity.Text = dr1("vnd_city") & "" End If dr2.Close() |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-08-13 : 11:31:58
|
Do a Response.Write "*" & Request.QueryString("name") & "*"I think the problem is that Request.QueryString("name") is only "A" because "&" character means another parameter value. E 12°55'05.25"N 56°04'39.16" |
 |
|
akpaga
Constraint Violating Yak Guru
331 Posts |
Posted - 2008-08-13 : 11:38:11
|
Yes it shows only A..what should be done to show both? |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-08-13 : 11:52:17
|
try encoding urlhttp://www.w3schools.com/tags/ref_urlencode.asp |
 |
|
akpaga
Constraint Violating Yak Guru
331 Posts |
Posted - 2008-08-13 : 12:20:48
|
I tried this but did not work ... Dim command As New SqlCommand("customerlist", conn)Command.CommandType = CommandType.StoredProcedurecommand.Parameters.AddWithValue("@company_name", SqlDbType.Char).Value = server.urlencode((Request.QueryString("name"))Dim dr1 As SqlDataReader = command.ExecuteReader()If dr1.Read Thentxtcompany.Text = dr1("company_name") & ""txtaddr1.Text = dr1("vnd_addr1") & ""txtaddr2.Text = dr1("vnd_addr2") & ""txtcity.Text = dr1("vnd_city") & ""End Ifdr2.Close() |
 |
|
akpaga
Constraint Violating Yak Guru
331 Posts |
Posted - 2008-08-13 : 12:36:33
|
I am using this code in the gridview properties for getting the querystringDataNavigateUrlFormatString="editpage.aspx?name={0}" |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-08-13 : 12:51:32
|
try this too:-http://instruct.tri-c.edu/rrichmond/html/querystring.htm |
 |
|
|