Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Feb 26, 2013 04:02 AM by rajendraram
Member
424 Points
148 Posts
Feb 26, 2013 03:33 AM|LINK
hello, how can i exclude the schema from the dataset?
thanks
public void GetDetailByZip(string inString) { SqlConnection cnnWebdb = new SqlConnection(sqlconn); try { string sqlstr = "SELECT WHOLE.*" + " FROM WHOLE (NOLOCK) INNER JOIN TrtyXRSM (NOLOCK) ON WHOLE.AUTONUM = TrtyXRSM.RSMID AND TrtyXRSM.EndDTM IS NULL AND WHOLE.TermDate IS NULL AND (WHOLE.RSMTyp = 'E' OR WHOLE.RSMTyp = 'A')" + " INNER JOIN Trty (NOLOCK) ON Trty.TrtyID = TrtyXRSM.TrtyID AND TrtyXRSM.EndDTM IS NULL" + " INNER JOIN TrtyXZip (NOLOCK) ON TrtyXZip.TrtyID = Trty.TrtyID and TrtyXZip.EndDTM is NULL" + " WHERE TrtyZip = @advisorZip"; SqlCommand scdGetRSM = new SqlCommand(sqlstr, cnnWebdb); cnnWebdb.Open(); scdGetRSM.Parameters.AddWithValue("@advisorZip", inString); SqlDataReader sdr = scdGetRSM.ExecuteReader(); DataTable dt = new DataTable(); dt.Load(sdr); if (dt.Rows.Count > 0) { ds = new DataSet(); ds.Tables.Add(dt); } else { err = "Zip code: " + inString + " does not have an advisor assigned."; } } catch (System.Exception ex) { err = ex.ToString(); } finally { cnnWebdb.Close(); } }
Participant
1358 Points
321 Posts
Feb 26, 2013 03:41 AM|LINK
Hi,
Please check below URL to find the answer for your question,
http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/827fa51d-5bc3-4955-95ed-624804079bcb/
http://bytes.com/topic/net/answers/178334-return-dataset-without-schema
Feb 26, 2013 03:55 AM|LINK
i already tried the DataSet.WriteXml and DataSet.ReadXml methods and still shows the schema. however when i write to a file it works.
812 Points
258 Posts
Feb 26, 2013 04:02 AM|LINK
Are you like this?
http://www.java2s.com/Tutorial/CSharp/0560__ADO.Net/Retrievesaschematableforaquery.htm
epasho
Member
424 Points
148 Posts
exclude dataset schema
Feb 26, 2013 03:33 AM|LINK
hello, how can i exclude the schema from the dataset?
thanks
public void GetDetailByZip(string inString) { SqlConnection cnnWebdb = new SqlConnection(sqlconn); try { string sqlstr = "SELECT WHOLE.*" + " FROM WHOLE (NOLOCK) INNER JOIN TrtyXRSM (NOLOCK) ON WHOLE.AUTONUM = TrtyXRSM.RSMID AND TrtyXRSM.EndDTM IS NULL AND WHOLE.TermDate IS NULL AND (WHOLE.RSMTyp = 'E' OR WHOLE.RSMTyp = 'A')" + " INNER JOIN Trty (NOLOCK) ON Trty.TrtyID = TrtyXRSM.TrtyID AND TrtyXRSM.EndDTM IS NULL" + " INNER JOIN TrtyXZip (NOLOCK) ON TrtyXZip.TrtyID = Trty.TrtyID and TrtyXZip.EndDTM is NULL" + " WHERE TrtyZip = @advisorZip"; SqlCommand scdGetRSM = new SqlCommand(sqlstr, cnnWebdb); cnnWebdb.Open(); scdGetRSM.Parameters.AddWithValue("@advisorZip", inString); SqlDataReader sdr = scdGetRSM.ExecuteReader(); DataTable dt = new DataTable(); dt.Load(sdr); if (dt.Rows.Count > 0) { ds = new DataSet(); ds.Tables.Add(dt); } else { err = "Zip code: " + inString + " does not have an advisor assigned."; } } catch (System.Exception ex) { err = ex.ToString(); } finally { cnnWebdb.Close(); } }"Intellectuals solve problems; geniuses prevent them"
-- Albert Einstein
farooque84
Participant
1358 Points
321 Posts
Re: exclude dataset schema
Feb 26, 2013 03:41 AM|LINK
Hi,
Please check below URL to find the answer for your question,
http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/827fa51d-5bc3-4955-95ed-624804079bcb/
http://bytes.com/topic/net/answers/178334-return-dataset-without-schema
epasho
Member
424 Points
148 Posts
Re: exclude dataset schema
Feb 26, 2013 03:55 AM|LINK
i already tried the DataSet.WriteXml and DataSet.ReadXml methods and still shows the schema. however when i write to a file it works.
"Intellectuals solve problems; geniuses prevent them"
-- Albert Einstein
rajendraram
Participant
812 Points
258 Posts
Re: exclude dataset schema
Feb 26, 2013 04:02 AM|LINK
Are you like this?
http://www.java2s.com/Tutorial/CSharp/0560__ADO.Net/Retrievesaschematableforaquery.htm