Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > Problem with a DataSet

Reply
Thread Tools

Problem with a DataSet

 
 
André Giesing
Guest
Posts: n/a
 
      09-01-2003
Hello!

I've made a simple WebService, which connects to a Access Database
selects everything out of the table "KUNDE" and gives it as a DataSet
back.
Here is the Code:

[WebMethod]
public DataSet GetKunden()
{
OleDbConnection con;
OleDbDataAdapter da;
OleDbCommand cmd;

DataTable tbl = new DataTable("Kunde");
DataSet ds = new DataSet("dsKunde");

try
{
//*1* Verbindung herstellen
con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; "
+ "Password=;User ID=;Data Source=;");

//*2* Command-Objekt anlegen
cmd = new OleDbCommand("SELECT * FROM KUNDE", con);

//*3* DataAdapter anlegen und Tabelle füllen
da = new OleDbDataAdapter(cmd);
da.Fill(tbl);

//*4* Tabelle dem DataSet hinzufügen
ds.Tables.Add(tbl);

//*5* DataSet zurückgeben
return(ds);
}
catch(Exception ex)
{
return(null);
}
}

In my little mobile Client I just want to get the Data and it should
be displayed in a simple DataGrid.
This is the Code I've made:

private DataSet m_dsDaten = new DataSet();
private void btnDatenHolen_Click(object sender, System.EventArgs e)
{
WebReference.Service ws = new WebReference.Service();

try
{
//*1* Kundendaten laden
m_dsDaten = ws.GetKunden();

//*2* DataGrid an Tabelle binden
dgKunden.DataSource = m_dsDaten.Tables["KUNDE"];
}
catch (Exception ex)
{
MessageBox.Show("Fehler in btnDatenHolen_Click: \n\n" +
ex.ToString());
}
}

But when I want to display the Data in my little mobile application
(in a DataGrid), I get the following error:

"System.InvalidOperationException:Server found request content type to
be 'text/html; charset=utf-8' but expected 'text/xml'."

Any ideas why I get this error?
 
Reply With Quote
 
 
 
 
Somchai U.
Guest
Posts: n/a
 
      09-02-2003
The URL of web service may be incorrect (for example, it may point to
localhost).

Somchai

"André Giesing" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) m...
> Hello!
>
> I've made a simple WebService, which connects to a Access Database
> selects everything out of the table "KUNDE" and gives it as a DataSet
> back.
> Here is the Code:
>
> [WebMethod]
> public DataSet GetKunden()
> {
> OleDbConnection con;
> OleDbDataAdapter da;
> OleDbCommand cmd;
>
> DataTable tbl = new DataTable("Kunde");
> DataSet ds = new DataSet("dsKunde");
>
> try
> {
> //*1* Verbindung herstellen
> con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; "
> + "Password=;User ID=;Data Source=;");
>
> //*2* Command-Objekt anlegen
> cmd = new OleDbCommand("SELECT * FROM KUNDE", con);
>
> //*3* DataAdapter anlegen und Tabelle füllen
> da = new OleDbDataAdapter(cmd);
> da.Fill(tbl);
>
> //*4* Tabelle dem DataSet hinzufügen
> ds.Tables.Add(tbl);
>
> //*5* DataSet zurückgeben
> return(ds);
> }
> catch(Exception ex)
> {
> return(null);
> }
> }
>
> In my little mobile Client I just want to get the Data and it should
> be displayed in a simple DataGrid.
> This is the Code I've made:
>
> private DataSet m_dsDaten = new DataSet();
> private void btnDatenHolen_Click(object sender, System.EventArgs e)
> {
> WebReference.Service ws = new WebReference.Service();
>
> try
> {
> //*1* Kundendaten laden
> m_dsDaten = ws.GetKunden();
>
> //*2* DataGrid an Tabelle binden
> dgKunden.DataSource = m_dsDaten.Tables["KUNDE"];
> }
> catch (Exception ex)
> {
> MessageBox.Show("Fehler in btnDatenHolen_Click: \n\n" +
> ex.ToString());
> }
> }
>
> But when I want to display the Data in my little mobile application
> (in a DataGrid), I get the following error:
>
> "System.InvalidOperationException:Server found request content type to
> be 'text/html; charset=utf-8' but expected 'text/xml'."
>
> Any ideas why I get this error?



 
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
DataSet and dataSet JimO ASP .Net 2 03-08-2006 02:39 PM
copying a datatable content from an untyped dataset into a table which is inside a typed dataset Nedu N ASP .Net 2 10-31-2003 01:05 PM
Ccopying a datatable content from an untyped dataset into a table which is inside a typed dataset Nedu N ASP .Net 1 10-31-2003 02:39 AM
DataSet to DataSet Joseph D. DeJohn ASP .Net 1 08-04-2003 03:25 AM



Advertisments