Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > problem sending significant whitespace in DataSets across webservice (dotnet 2.0)

Reply
Thread Tools

problem sending significant whitespace in DataSets across webservice (dotnet 2.0)

 
 
Stephen Ahn
Guest
Posts: n/a
 
      07-09-2007
Using VS2005, dotnet 2.0.
Here's some code which reproduces the issue.

Web Service code :
==
[WebMethod]
public string SendDataSet(DataSet ds)
{
DataRow dr = ds.Tables[0].Rows[0];

string sCurrent = (string)dr[0, DataRowVersion.Current];
string sOriginal = (string)dr[0, DataRowVersion.Original];

return "current : " + GetStringAsHex(sCurrent) + ", original : "
+ GetStringAsHex(sOriginal);

}

private static string GetStringAsHex(string str)
{
System.Text.StringBuilder sb = new
System.Text.StringBuilder("0x");
for (int i = 0; i < str.Length; i++)
{
sb.AppendFormat("{0:X2}", (int)str[i]);
}

return sb.ToString();
}
==

Run this code on the client end :
==
private void bDataSetTest_Click(object sender, EventArgs e)
{
DataSet ds = new DataSet();
DataTable dt = ds.Tables.Add("t");
dt.Columns.Add("Data", typeof(string));

DataRow dr = dt.NewRow();
dr["Data"] = "\n";
dt.Rows.Add(dr);
dt.AcceptChanges();
dr["Data"] = "\n";


HelloWorldWebServiceTestApp.localhost.HelloWorldWe bService ws =
new HelloWorldWebServiceTestApp.localhost.HelloWorldWe bService();
ws.Url = this.tbUrl.Text.Trim();

string res = ws.SendDataSet(ds);
MessageBox.Show(res);
}
==

The messagebox displays : "current : 0x0A, original : 0x".
I was expecting : "current : 0x0A, original : 0x0A".

So, there seems to be a problem with the original value of columns which
only contain whitespace. The web method does not see exactly what the client
has sent.

Any ideas ?
Thanks,
Stephen









 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Significant whitespace Dan Stromberg Python 1 01-01-2010 11:29 PM
most significant and less significant address a01lida VHDL 2 11-16-2008 12:28 PM
Significant Digits (Significant Figures) SMH Javascript 0 01-07-2007 09:52 AM
do people really complain about significant whitespace? infidel Python 57 08-10-2006 04:49 PM
Python with no significant whitespace mep Python 3 01-26-2005 09:50 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57