how can we get the result of the quries in all boxes such as in database there is name and id so i want that after select * from table the results will show in both the boxes name and id respectully can any one help???
am working with this type of coding
am working with this type of coding
Code:
Imports System.Data.SqlClient
Public Class Database
Dim strCON As String = "Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\Darul-ehsan\Documents\Bilal.mdf;Integrated Security=True;Connect Timeout=30"
Dim SQLconnect As SqlConnection = New SqlConnection(strCON)
Private Sub Database_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Try
If SQLconnect.State = ConnectionState.Closed Then
SQLconnect.Open()
MessageBox.Show("Connected", "OOps", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Try
If nametxt.Text = "" Then
MsgBox("Name Feild Empty")
Else
If ageint.Text = "" Then
MsgBox("Emmpty")
Else
Dim cmmd As SqlCommand = New SqlCommand("INSERT INTO Info(name,age) VALUES('" & nametxt.Text & "' , '" & ageint.Text & "')", SQLconnect)
cmmd.ExecuteNonQuery()
MsgBox("OK")
nametxt.Text = ""
ageint.Text = ""
End If
End If
Catch ex As Exception
'do something
MessageBox.Show(ex.Message)
End Try
End Sub
Private Sub textbox_textchanged(sender As Object, e As EventArgs) Handles nametxt.TextChanged, ageint.TextChanged
Dim ch As Integer
Dim check As Boolean = Integer.TryParse(ageint.Text, ch)
If check = True Then
Button1.Enabled = True
Else
Button1.Enabled = False
End If
End Sub
End Class
Comment