我有一个 GUID (varchar(50,notnull) in sql) 我是通过 VB 中的 ExecuteScalar() 从 SQL 返回的图形用户界面
当我运行程序时,它看起来像 trucates GUID 示例 {3F2504E0-4F89-11D3-9A0C-0305E82C3301}
样本错误浮点值“3F2504E0”超出计算机表示的范围(8 字节)
我的 executeScalar 是否截断了这些信息?
代码:
Dim sqlquery As String
Dim ConnectionString As String
If cmboxDatabaseName.Text <> "" Then
ConnectionString = "Server=" + ServerName + "\" + InstanceName + "; Database=" + Control + "; User Id=" + UserId + ";Password=" + Password + ";"
sqlquery = "Select top 1 GUID from dbo.Databases with(Nolock) where dbName = '" + cmboxDatabaseName.Text + "'"
'Connect
Using conn As SqlConnection = New SqlConnection(ConnectionString)
conn.Open()
Using comm As SqlCommand = New SqlCommand(sqlquery, conn)
Hosted_GUID = comm.ExecuteScalar()
conn.Close()
End Using 'comm
conn.Close()
End Using 'conn