Somchai U.
9/2/2003 6:18:00 AM
The URL of web service may be incorrect (for example, it may point to
localhost).
Somchai
"André Giesing" <andregiesing@gmx.de> wrote in message
news:f945f95.0309010717.5ce04026@posting.google.com...
> 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?