日期:2014-05-20  浏览次数:20888 次

请问以下语句改为C#中的写法?


Dim   strSQL   As   String   =   _
                        "IF   EXISTS   ( "   &   _
                        "SELECT   *   "   &   _
                        "FROM   northwind.dbo.sysobjects   "   &   _
                        "WHERE   NAME   =   'Picture '   "   &   _
                        "AND   TYPE   =   'u ') "   &   vbCrLf   &   _
                        "BEGIN "   &   vbCrLf   &   _
                        "DROP   TABLE   Northwind.dbo.picture "   &   vbCrLf   &   _
                        "END "   &   vbCrLf   &   _
                        "CREATE   TABLE   Picture   ( "   &   _
                        "PictureID   Int   IDENTITY(1,1)   NOT   NULL, "   &   _
                        "[FileName]   Varchar(255)   NOT   NULL, "   &   _
                        "Picture   Image   NOT   NULL, "   &   _
                        "CONSTRAINT   [PK_Picture]   PRIMARY   KEY   CLUSTERED "   &   _
                        "(PictureID)) "

先谢谢了!

------解决方案--------------------
string strSQL= "IF EXISTS ( " + "SELECT * " +..........

------解决方案--------------------
string strSQL =
"IF EXISTS ( " +
"SELECT * " +
"FROM northwind.dbo.sysobjects " +
"WHERE NAME = 'Picture ' " +
"AND TYPE = 'u ')\r\n " +
"BEGIN\r\n " +
"DROP TABLE Northwind.dbo.picture\r\n " +
"END\r\n " +
"CREATE TABLE Picture ( " +
"PictureID Int IDENTITY(1,1) NOT NULL, " +
"[FileName] Varchar(255) NOT NULL, " +
"Picture Image NOT NULL, " +
"CONSTRAINT [PK_Picture] PRIMARY KEY CLUSTERED " +
"(PictureID)) ";