Click here to Skip to main content
16,005,141 members
Home / Discussions / C#
   

C#

 
GeneralSMS Application Pin
A Khan20-Feb-05 22:06
sussA Khan20-Feb-05 22:06 
GeneralRe: SMS Application Pin
Heath Stewart21-Feb-05 6:45
protectorHeath Stewart21-Feb-05 6:45 
QuestionGood security project idea in C#? Pin
Mohammed Aijaz Mohiuddin20-Feb-05 20:22
Mohammed Aijaz Mohiuddin20-Feb-05 20:22 
AnswerRe: Good security project idea in C#? Pin
Mohammed Aijaz Mohiuddin20-Feb-05 20:23
Mohammed Aijaz Mohiuddin20-Feb-05 20:23 
QuestionPanel Layout problem? Pin
Tee+20-Feb-05 16:43
Tee+20-Feb-05 16:43 
GeneralOverride wait cursor Pin
eggie520-Feb-05 16:29
eggie520-Feb-05 16:29 
GeneralI'd like to use the column like the header column in DataGrid Pin
yu-yu20-Feb-05 14:41
yu-yu20-Feb-05 14:41 
GeneralDatasets and Web Services Pin
ronin177020-Feb-05 14:01
ronin177020-Feb-05 14:01 
HI,

I am trying to build a simple web services which simply get list of employee's last name from Sql server's database. The method in web-service class is supposed to read the data from the db and return the results in a form of DataSet and it is defined as :

---------------------------------------
//a web method which retrieves data (last names of about given
//thing in form of a data set
[WebMethod(BufferResponse=true)]
public DataSet getLastNames() {
//string var representing sql string
string sql = "";

//create a new temp dataset
DataSet ds = new DataSet();
try {
//open the connection
scConn.Open();

//create the sql
sql = "SELECT LastName FROM tblEmployees";

//create the command
cmd = new SqlCommand(sql,scConn);

//create the sql data adapter
SqlDataAdapter sda = new SqlDataAdapter(cmd);

sda.Fill(ds,"Employees");
Console.WriteLine(ds.Tables.Count);

//clean up code
sda=null;
cmd=null;
scConn.Close();

return ds;
}
catch(Exception ex) { Console.WriteLine(ex.ToString()); }
}
----------------------------------------------------

I want to display the data from the dataset in a DataGrid (in a Windows Form) in a DataGrid. Window form also contains one button which calls webmethod and fills out datagrid. The code is given as :

---------------------------
private void cmdConnect_Click(object sender, System.EventArgs e)
{
try
{
DataSet ds = new DataSet();

localhost.wsEmployees ws = new wsEmployeesClient.localhost.wsEmployees();
ds = ws.getLastNames();

Console.WriteLine(ds.Tables[0].Rows);
}
catch(Exception ex) { Console.WriteLine(ex.ToString()); }
}
------------------------------
note localhost = name of web reference
-----------------------------------

Problem : No records can be found. There is no table in dataset.

I just want to know what i am doing WRONG. Am I missing out something either in code or IIS Server's Administration.

thanx in advance



GeneralRe: Datasets and Web Services Pin
Kodanda Pani20-Feb-05 18:24
Kodanda Pani20-Feb-05 18:24 
GeneralTimer on a new thread Pin
eggie520-Feb-05 12:15
eggie520-Feb-05 12:15 
GeneralRe: Timer on a new thread Pin
S. Senthil Kumar20-Feb-05 13:20
S. Senthil Kumar20-Feb-05 13:20 
GeneralRe: Timer on a new thread Pin
eggie520-Feb-05 14:35
eggie520-Feb-05 14:35 
GeneralRe: Timer on a new thread Pin
eggie520-Feb-05 15:08
eggie520-Feb-05 15:08 
GeneralRe: Timer on a new thread Pin
S. Senthil Kumar20-Feb-05 15:33
S. Senthil Kumar20-Feb-05 15:33 
GeneralRe: Timer on a new thread Pin
eggie520-Feb-05 16:25
eggie520-Feb-05 16:25 
QuestionChecking the attributes of a directory? Pin
Marlun20-Feb-05 11:40
Marlun20-Feb-05 11:40 
QuestionHow to arrange attribute of PropertyGrid Pin
lee meng20-Feb-05 9:44
lee meng20-Feb-05 9:44 
AnswerRe: How to arrange attribute of PropertyGrid Pin
Mathew Hall20-Feb-05 13:47
Mathew Hall20-Feb-05 13:47 
GeneralRe: How to arrange attribute of PropertyGrid Pin
lee meng21-Feb-05 6:41
lee meng21-Feb-05 6:41 
GeneralRe: How to arrange attribute of PropertyGrid Pin
Mathew Hall21-Feb-05 15:12
Mathew Hall21-Feb-05 15:12 
GeneralRe: How to arrange attribute of PropertyGrid Pin
lee meng22-Feb-05 2:14
lee meng22-Feb-05 2:14 
GeneralSocket polling Pin
Magnus2720-Feb-05 7:47
Magnus2720-Feb-05 7:47 
GeneralNET and DCOM Pin
vad_kr20-Feb-05 4:21
vad_kr20-Feb-05 4:21 
GeneralRe: NET and DCOM Pin
Rob Graham20-Feb-05 8:23
Rob Graham20-Feb-05 8:23 
GeneralRe: NET and DCOM Pin
vad_kr20-Feb-05 20:45
vad_kr20-Feb-05 20:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.