Hi all expert, How to give message in method type dataset in web service. In else part of if I want to give some message like "Access is denied ". Here is my code. Pls help me. [WebMethod, SoapHeader("spAuthenticationHeader")] public DataSet GetCustList() { if (spAuthenticationHeader.strUserName == "TestUser" && spAuthenticationHeader.strPassword == "TestPassword") { DataSet ds = new DataSet(); CustomerDAL Customer = new CustomerDAL(); return Customer.GetCustomer(); } else { //string mymessage = "Access is Denied"; //DataSet ds1 = new DataSet(); Here i want to give message like ""Access is Denied"; }
} |
Loading
Koteswararao MallisettiPosted Oct 26, 2010, 6:14 AM
DataSet ds = new DataSet();
DataTable dt = new DataTable("msg");
DataColumn dc = new DataColumn("col1");
dc.DataType = typeof(string);
dc.ColumnName = "msg";
dt.Columns.Add(dc);
ds.Tables.Add(dt);
DataRow dr = dt.NewRow();
dr[0] = "Access is denied";
ds.Tables["msg"].Rows.Add(dr);
return ds;
Suthish NairPosted Oct 26, 2010, 6:47 AM
Better update your name first, are you hiding from someone?
AnkurPosted Oct 26, 2010, 6:11 AM
try return Object type instead Dataset.
hope this would help.
Thanks and Regards