08-04-16, 11:01 PM
السلام عليكم انا كنت عاوز اجيب داتا من Sql من Column معين و اضيفه في Textbox بس و جهتني مشكله جتلي رساله بتقولي
CurLevel مع العلم CurLevel دي اسم ال Column
اكوادي...
CurLevel مع العلم CurLevel دي اسم ال Column
اكوادي...
كود :
imports system.data.sqlclient
mysqlconn = New SqlConnection
mysqlconn.ConnectionString = "Data Source=" + txtServerName.Text + ";initial catalog=" + txtdatabasename.Text + ";initial catalog=" + txtshardacc.Text + ";user id=" + textusername.Text + ";password=" + txtpassword.Text
Dim queryresult As Integer
Try
mysqlconn.Open()
command = New SqlCommand("select COUNT (*) as numRows from _Char Where CharName16='" & TextBox40.Text & "'", mysqlconn)
queryresult = command.ExecuteScalar
mysqlconn.Close()
If queryresult = 0 Then
MsgBox("charactername not found ", MsgBoxStyle.Critical, "Error")
Else
MsgBox("(1) Username Found " & TextBox40.Text, MsgBoxStyle.Information, "Done")
TextBox29.Enabled = True
TextBox30.Enabled = True
TextBox31.Enabled = True
TextBox32.Enabled = True
TextBox32.Enabled = True
TextBox33.Enabled = True
TextBox34.Enabled = True
TextBox35.Enabled = True
TextBox36.Enabled = True
TextBox37.Enabled = True
TextBox38.Enabled = True
TextBox39.Enabled = True
Try
mysqlconn.Open()
Dim reader As SqlDataReader
reader = command.ExecuteReader
If reader.HasRows Then
TextBox39 = reader.Item("Curlevel")
End If
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End If
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub