sql refresh
-
hello I am new and i have just started learning sql 2005 and i have create small table student with 3 columns studentID,firstname and lastname it's works fine i can insert,delete without any problem but when i delete any antry it dosent refresh the page i mean it delete record from sql database but it shows deleted entry in text boxes but if i close application and restart it it dosent show deleted entry any help this is the code for delete
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click Dim SQL As String = Nothing SQL = "DELETE FROM Student WHERE StudentID = " & TextBox3.Text If MessageBox.Show("Are you sure you want to delete", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) = MsgBoxResult.Yes Then conStudent = New Data.SqlClient.SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Documents and Settings\bablu\My Documents\Visual Studio 2005\Projects\SQL DataApplication\SQL DataApplication\Student.mdf;Integrated Security=True;User Instance=True") conStudent.Open() Try commStudent = New SqlClient.SqlCommand(SQL, conStudent) commStudent.ExecuteNonQuery() MsgBox("Itemdeleted successfully", MsgBoxStyle.Information) Catch ex As Exception MsgBox(ex.Message) End Try conStudent.Close() conStudent.Dispose() Else Exit Sub End If End Sub
any help :confused: waiting for your kind rep. have a nice time thanks -
hello I am new and i have just started learning sql 2005 and i have create small table student with 3 columns studentID,firstname and lastname it's works fine i can insert,delete without any problem but when i delete any antry it dosent refresh the page i mean it delete record from sql database but it shows deleted entry in text boxes but if i close application and restart it it dosent show deleted entry any help this is the code for delete
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click Dim SQL As String = Nothing SQL = "DELETE FROM Student WHERE StudentID = " & TextBox3.Text If MessageBox.Show("Are you sure you want to delete", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) = MsgBoxResult.Yes Then conStudent = New Data.SqlClient.SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Documents and Settings\bablu\My Documents\Visual Studio 2005\Projects\SQL DataApplication\SQL DataApplication\Student.mdf;Integrated Security=True;User Instance=True") conStudent.Open() Try commStudent = New SqlClient.SqlCommand(SQL, conStudent) commStudent.ExecuteNonQuery() MsgBox("Itemdeleted successfully", MsgBoxStyle.Information) Catch ex As Exception MsgBox(ex.Message) End Try conStudent.Close() conStudent.Dispose() Else Exit Sub End If End Sub
any help :confused: waiting for your kind rep. have a nice time thanks -
hello first of all thanks for your rep. i have tried it but it's not working this is the code
conStudent.Open() Try commStudent = New SqlClient.SqlCommand(SQL, conStudent) commStudent.ExecuteNonQuery() conStudent.Close() <------:confused: conStudent.Open() <------:confused: MsgBox("Item deleted", MsgBoxStyle.Information) Catch ex As Exception MsgBox(ex.Message) End Try conStudent.Close() conStudent.Dispose()
is this what you are saying or some thing else waiting for your kid rep. have a nice day -
hello I am new and i have just started learning sql 2005 and i have create small table student with 3 columns studentID,firstname and lastname it's works fine i can insert,delete without any problem but when i delete any antry it dosent refresh the page i mean it delete record from sql database but it shows deleted entry in text boxes but if i close application and restart it it dosent show deleted entry any help this is the code for delete
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click Dim SQL As String = Nothing SQL = "DELETE FROM Student WHERE StudentID = " & TextBox3.Text If MessageBox.Show("Are you sure you want to delete", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) = MsgBoxResult.Yes Then conStudent = New Data.SqlClient.SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Documents and Settings\bablu\My Documents\Visual Studio 2005\Projects\SQL DataApplication\SQL DataApplication\Student.mdf;Integrated Security=True;User Instance=True") conStudent.Open() Try commStudent = New SqlClient.SqlCommand(SQL, conStudent) commStudent.ExecuteNonQuery() MsgBox("Itemdeleted successfully", MsgBoxStyle.Information) Catch ex As Exception MsgBox(ex.Message) End Try conStudent.Close() conStudent.Dispose() Else Exit Sub End If End Sub
any help :confused: waiting for your kind rep. have a nice time thanks -
hi , in try block after query exection just assign textbox.text=""; i think this solves u r problem . if this is in webapplication we can set viewstate as false . bye .
hello thansk for your kind rep. yes i have tried that before but it's not working well it's clear the text box but it also shows empty textbox when you move next or previous so i dont know what to do still waiting for help :confused: :zzz: have a nice day