我在下面添加連接字符串,並把它在web.config中我要截斷數據庫表
<add name="cn" connectionString="data source=10.209.46.210;Initial Catalog=EDWP;User ID=kbanke2e;Password=passw0rd;Persist Security Info=True;Port=5480;Optimize for ASCII=True;" providerName="NZOLEDB"/>
上app.vb我嘗試編碼以下截斷表,但是錯誤是填充
Protected Sub Button1_click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
Dim cnn As String = ConfigurationManager.ConnectionStrings("cn").ConnectionString
Dim strSQL As String
strSQL = "TRUNCATE TABLE EDWID02.EXT_RBS_SMN1S00648_1"
Using connection As New SqlConnection("cnn")
Dim cmd As New SqlCommand(strSQL, connection)
cmd.Connection.Open()
cmd.ExecuteNonQuery()
End Using
End Sub
誤差低於
Format of the initialization string does not conform to specification starting at index 0. 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.ArgumentException: Format of the initialization string does not conform to specification starting at index 0.
Source Error:
Line 12: Dim strSQL As String Line 13: strSQL = "TRUNCATE TABLE EDWID02.EXT_RBS_SMN1S00648_1" Line 14: Using connection As New SqlConnection("cnn") Line 15: Line 16: Dim cmd As New SqlCommand(strSQL, connection)
嘖嘖,只要有辦法知道錯誤是什麼,你提了。如果只有某個實際上看過它的人可以告訴我們錯誤信息是什麼以及還提供了其他任何信息。 – jmcilhinney
我加了這個編程的錯誤 –
我當然希望這不是真正的用戶名和密碼。 – vesan