J'ai un petit probleme avec ma base de donnees...
J'arrive sans probleme a ecrire dans la base et a recuperer la base dans un xml avec ce code :
Protected
Sub _Submit_Click(ByVal sender AsObject, ByVal e As System.EventArgs)Dim SQL AsString
SQL = "SELECT * FROM Table1 FOR XML AUTO,XMLDATA"
Dim ConnStr AsString
ConnStr = "Data Source=.\SQLEXPRESS;AttachDbFilename=""C:\Documents and Settings\gb51348\My Documents\Visual Studio 2005\WebSites\WebSite3\App_Data\db.mdf"";Integrated Security=True;Connect Timeout=30;User Instance=True"
Dim mySqlConn AsNew SqlConnection(ConnStr)
mySqlConn.Open()
Dim mySqlCmd AsNew SqlCommand(SQL, mySqlConn)
Dim myDS AsNew DataSet
myDS.ReadXml(mySqlCmd.ExecuteXmlReader, XmlReadMode.Fragment)
XmlDisplay.DocumentContent = myDS.GetXml
mySqlConn.Close()
EndSub
Mais des que je modifie les arguments de la requete SQL Select, cela genere une erreur...
(SQL = "SELECT * FROM Table1 WHERE Category='Material Query' FOR XML AUTO,XMLDATA")
The data types text and varchar are incompatible in the equal to operator.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: The data types text and varchar are incompatible in the equal to operator.