所以我试着根据我的sob服务器中链接的组合框来填充我的文本框。
每次我在ComboBox中选择一个项目时都会出现此错误。
connectionstring属性尚未初始化
Private Sub CBuname_SelectedIndexChanged(sender As Object, e As EventArgs) Handles CBuname.SelectedIndexChanged
Dim cmd As New SqlCommand()
Dim Reader As SqlDataReader
Try
con.Open()
Dim sql As String = "Select * From CoAdminData where Username='" & CBuname.Text & "'"
cmd = New SqlCommand(sql, con)
Reader = cmd.ExecuteReader
If Reader.HasRows() Then
While Reader.Read
txtSID.Text = Reader("StudentID")
txtFirstname.Text = Reader("Firstname")
txtLastname.Text = Reader("Lastname")
End While
End If
con.Close()
Catch ex As Exception
MsgBox(ex.Message)
Finally
con.Dispose()
End Try
End Sub
答案 0 :(得分:0)
只是提供一个可以使用/修改的完整示例和模板。我已经评论了你需要做的一切 不要在公共类中声明con,而是尝试使用每种方法打开和关闭它。你可以在其他地方公开宣布constr,这可以为你节省一些写作。 HTH
var CryptoJS = require("crypto-js");
// the input values
var base64Header = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9";
var base64Payload = "eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ";
var secret = "hONPMX3tHWIp9jwLDtoCUwFAtH0RwSK6";
// two hashes from different online tools
var signatureJWTIO = "3pIaKksiX9Zv8Jg-hWbrD24VhL36hBIFaNpA4fVx29M";
var onlineCaluclatedHS256 = "de921a2a4b225fd66ff0983e8566eb0f6e1584bdfa84120568da40e1f571dbd3";
// hash calculation with Crypto-JS.
// The two replace expressions convert Base64 to Base64url format by replacing '+' with '-'
// and stripping the '=' padding
var base64Signature = CryptoJS.HmacSHA256(base64Header + "." + base64Payload , secret).toString(CryptoJS.enc.Base64).replace(/\+/g,'-').replace(/\=+$/m,'');
// converting the online calculated value to Base64 representation
var base64hash = new Buffer(onlineCaluclatedHS256, 'hex').toString('base64').replace(/\+/g,'-').replace(/\=+$/m,'');
// the results:
console.log("Signature from JWT.IO : " + signatureJWTIO);
console.log("NodeJS calculated hash : " + base64Signature);
console.log("online calulated hash (converted) : " + base64hash);