Kann nicht implizit konvertiert Typ 'System.Daten.DataSet' zu 'string'

Dem folgenden code wird die web-Methode (ist die häufigste, wie Sie es sehen kann, überall), aber ich erhalte die Fehlermeldung aus dem Titel. Ich bin am Anfang mit .NET, also wenn jemand kann mich in die richtige Richtung , so tun Sie dies bitte.

SqlConnection myConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["mySQLconn"].ConnectionString);

[WebMethod(Description = "Select Customers")]
    public string GetVersionofSelectedCustomer(string versionEmail)
    {

        string select = "SELECT version FROM customer WHERE EMAIL = '" + versionEmail + "'";
        SqlDataAdapter adapter = new SqlDataAdapter(select, myConnection);

        DataSet custDS = new DataSet();            
        //adapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
        adapter.Fill(custDS, "Customers");

        return custDS;

    }

Verbindung ist definiert in der Web.config (LAN-Verbindung) und zurück custDS; ist, wo es scheitert.

  • Warum sind Sie Rückgabe einem DataSet, kann man vielleicht wieder eine JSON-response mit dem Kunden Liste drin.
InformationsquelleAutor observ | 2012-05-22
Schreibe einen Kommentar