clement1086
Messages postés3Date d'inscriptionlundi 7 juin 2004StatutMembreDernière intervention17 août 2006
-
10 août 2006 à 12:58
clement1086
Messages postés3Date d'inscriptionlundi 7 juin 2004StatutMembreDernière intervention17 août 2006
-
11 août 2006 à 10:23
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"
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.
cs_skweeky
Messages postés259Date d'inscriptionmercredi 3 mai 2006StatutMembreDernière intervention11 janvier 20108 10 août 2006 à 20:21
Category ne serait pas de type text par hazard ?
Le mieux si c'est le cas serait de le passer en varchar(max) ou un varchar(xxx) où xxx est compris entre 1 et 8000, c'est à dire la longueur maxi de la chaîne.
Vu l'exemple, la chaîne n'a pas l'air d'être très longue, donc un vachar(100) oar exemple serait très bien pour ce champ dans la table.