471,066 Members | 967 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

C# to ASP to ACCESS having Charest conversion difficulties


Hi,
I am still having Charest conversion
difficulties s when passing string from C# TO ASP and than to access using
ADO
I am using HttpWebRequest to POST some Multilanguage(Hebrew and English)
to an ASP page which in turn uses ADO to save them to an access data base
the access data base support(as I underatdn( UNICODE strings),I can insert
Hebrew string fro access IDE)
Here is the code which create the POST request

//Executing POST command

string strPost=string.Format(
"GUID={0}"+
"&UserPassword={1}"+
"&Email1Address={2}"+
"&Email2Address={3}"+
"&Department={4}"+
"&FirstName={5}",
Guid,
UserPassword,
Email1Address,
Email2Address,
HttpUtility.UrlEncode(Department),
HttpUtility.UrlEncode(FirstName))

HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create(url);
objRequest.Method = "POST";
byte[] data = Encoding.UTF8.GetBytes(strPost);
objRequest.ContentLength = data.Length;
objRequest.ContentType = "application/x-www-form-urlencoded";
try
{

System.IO.Stream stream=objRequest.GetRequestStream();
stream.Write(data,0,data.Length);
stream.Close();
}
catch(Exception e)
{
Console.Write(e.Message);
return false;
}

HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse();
using (StreamReader sr = new StreamReader(objResponse.GetResponseStream()) )
{
result = sr.ReadToEnd();
sr.Close();
}
return result.ToLower().IndexOf("true")!=-1;
}

and here is the ASP code which save the data the the data base

///The ASP which process the request

<%@ Language=VBScript %>
<%Option explicit
Response.Buffer=TRUE%>
<object RUNAT="server" PROGID="ADODB.Recordset" id="rs"></object>
<object RUNAT="server" PROGID="ADODB.Connection" id="conn"></object>
<%
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"

//Just create the SQL UPDATE query

SqlString="update Graduates set "
for each i in Request.Form
SqlString = SqlString & i & " = " & RemoveNullNumber(Request.Form(i),0) &
","
next
SqlString= mid(SqlString,1,len(SqlString)-1)
SqlString=SqlString & " where [Password]= '" & Request.Form("GUID") & "'"
conn.Execute SqlString,rsAffected
conn.Close
if rsAffected=0 then
Response.Write SqlString
else
Response.Write "True"
end if
Response.End
%>
When display the result in a web page i see gibberish for records which was
entered using the ASP page
and Hebrew for records which entered using access IDE

I tried several encoders with no luck.

Thanks in advance for any help
Nov 17 '05 #1
0 1099

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by John Phelan | last post: by
1 post views Thread by ghero180 | last post: by
8 posts views Thread by reema via AccessMonster.com | last post: by
reply views Thread by leo001 | last post: by

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.