K
Kewat_Aniruddh
Guest
this is my VB code.what i want to do is to display all data from the table with same Email,line by line in the TextBox and
in the DataGrid View.i am able to display only the recent data,that is the first Row that is displayed in my Datagrid View in the textbox field. And i want to perform action like deletion of Row and update the content of a specific column cell by a button in the DataGrid View.......
thanks.....
Imports System.Data
Imports System.Data.SqlClient
Partial Public Class checkemail-------------------------checkmail
Inherits System.Web.UI.Page
Dim s As String = "Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\ANDY\Documents\MYSQL.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"
Dim sql As String
Dim con As SqlConnection
Dim cmd As SqlCommand
Dim dr As SqlDataReader
Dim da As SqlDataAdapter
Dim ds As DataSet
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
txtemail.Text = ""
con = New SqlConnection(s)
con.Open()
End Sub
Protected Sub btnok_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnok.Click
sql = "select * from email where senior_email=" & txtemail.Text & " "
cmd = New SqlCommand(sql, con)
dr = cmd.ExecuteReader
If dr.Read Then
TextBox1.Text = dr("username") & " " & dr("from_date") & " " & dr("to_date") & " " & dr("no_of_days") & " " & dr("reason") & " " & dr("contact") & " " & dr("status")
Else
TextBox1.Text = "INCORRECT"
End If
loadgrid()
End Sub
Public Sub loadgrid()
sql = "select * from email where senior_email=" & txtemail.Text & " "
cmd = New SqlCommand(sql, con)
da = New SqlDataAdapter(cmd)
ds = New DataSet
da.Fill(ds)
mygrid.DataSource = ds
mygrid.DataBind()
End Sub
End Class
Continue reading...
in the DataGrid View.i am able to display only the recent data,that is the first Row that is displayed in my Datagrid View in the textbox field. And i want to perform action like deletion of Row and update the content of a specific column cell by a button in the DataGrid View.......
thanks.....
Imports System.Data
Imports System.Data.SqlClient
Partial Public Class checkemail-------------------------checkmail
Inherits System.Web.UI.Page
Dim s As String = "Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\ANDY\Documents\MYSQL.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"
Dim sql As String
Dim con As SqlConnection
Dim cmd As SqlCommand
Dim dr As SqlDataReader
Dim da As SqlDataAdapter
Dim ds As DataSet
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
txtemail.Text = ""
con = New SqlConnection(s)
con.Open()
End Sub
Protected Sub btnok_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnok.Click
sql = "select * from email where senior_email=" & txtemail.Text & " "
cmd = New SqlCommand(sql, con)
dr = cmd.ExecuteReader
If dr.Read Then
TextBox1.Text = dr("username") & " " & dr("from_date") & " " & dr("to_date") & " " & dr("no_of_days") & " " & dr("reason") & " " & dr("contact") & " " & dr("status")
Else
TextBox1.Text = "INCORRECT"
End If
loadgrid()
End Sub
Public Sub loadgrid()
sql = "select * from email where senior_email=" & txtemail.Text & " "
cmd = New SqlCommand(sql, con)
da = New SqlDataAdapter(cmd)
ds = New DataSet
da.Fill(ds)
mygrid.DataSource = ds
mygrid.DataBind()
End Sub
End Class
Continue reading...