Click here to Skip to main content
16,015,393 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionWindows Service not working Pin
svanwass29-Apr-08 15:54
svanwass29-Apr-08 15:54 
QuestionSQL help [modified] Pin
bapu288929-Apr-08 9:41
bapu288929-Apr-08 9:41 
AnswerRe: SQL help Pin
Ray Cassick29-Apr-08 11:54
Ray Cassick29-Apr-08 11:54 
QuestionRe: SQL help Pin
bapu288930-Apr-08 8:03
bapu288930-Apr-08 8:03 
AnswerRe: SQL help Pin
Ray Cassick30-Apr-08 8:37
Ray Cassick30-Apr-08 8:37 
QuestionRe: SQL help Pin
bapu28891-May-08 8:32
bapu28891-May-08 8:32 
AnswerRe: SQL help Pin
Ray Cassick1-May-08 11:02
Ray Cassick1-May-08 11:02 
AnswerRe: SQL help Pin
bapu28892-May-08 9:29
bapu28892-May-08 9:29 
Hello sir

thank you very much for you help and finally job done Smile | :)

this is the final code and it's working fine

 Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click<br />
        Dim SQL As String = Nothing<br />
        conStudent = New Data.SqlClient.SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=C:\SQL DataApplication\SQL DataApplication\Student.mdf;Integrated Security=True;User Instance=True")<br />
        SQL = "DELETE FROM Student WHERE StudentID = " & TextBox3.Text<br />
        If MessageBox.Show("Are you sure you want to delete", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) = MsgBoxResult.Yes Then<br />
            conStudent.Open()<br />
            Try<br />
                commStudent = New SqlClient.SqlCommand(SQL, conStudent)<br />
                commStudent.ExecuteNonQuery()<br />
                MsgBox("Itemdeleted successfully", MsgBoxStyle.Information)<br />
            Catch ex As Exception<br />
                MsgBox(ex.Message)<br />
            End Try<br />
            conStudent.Close()<br />
        Else<br />
            Exit Sub<br />
        End If<br />
        dsStudent.Clear()<br />
        Call LoadData()<br />
<br />
    End Sub<br />
<br />
<br />
<br />
  Private Sub LoadData()<br />
        conStudent = New Data.SqlClient.SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=C:\SQL DataApplication\SQL DataApplication\Student.mdf;Integrated Security=True;User Instance=True")<br />
<br />
        If conStudent.State = ConnectionState.Open Then<br />
            conStudent.Close()<br />
        End If<br />
     <br />
        Try<br />
            conStudent.Open()<br />
            daStudent.Fill(dsStudent, "Student")<br />
            Label1.Text = Me.StudentBindingSource.Position<br />
        Catch ex As Exception<br />
            MsgBox(ex.Message)<br />
        End Try<br />
        conStudent.Close()<br />
        conStudent.Dispose()<br />
       <br />
    End Sub


i am going to make few changes like connection here i am using connecting string more then one time so i can make sub for it and call it when ever it's needed

but the method i am using is this the one of the right method ? I just want to know your views as an expert and still


thanks again sir for your help

have a nice week end

take care Rose | [Rose] Rose | [Rose]
GeneralRe: SQL help Pin
Ray Cassick2-May-08 9:37
Ray Cassick2-May-08 9:37 
GeneralSending text to the printer Pin
MikeMarq29-Apr-08 8:40
MikeMarq29-Apr-08 8:40 
AnswerRe: Sending text to the printer Pin
Smithers-Jones29-Apr-08 8:53
Smithers-Jones29-Apr-08 8:53 
GeneralRe: Sending text to the printer Pin
MikeMarq29-Apr-08 15:40
MikeMarq29-Apr-08 15:40 
AnswerRe: Sending text to the printer Pin
Smithers-Jones29-Apr-08 21:33
Smithers-Jones29-Apr-08 21:33 
GeneralRe: Sending text to the printer Pin
MikeMarq30-Apr-08 2:10
MikeMarq30-Apr-08 2:10 
AnswerRe: Sending text to the printer Pin
Smithers-Jones30-Apr-08 3:04
Smithers-Jones30-Apr-08 3:04 
QuestionHow to write a help-assistant like office Assistant? Pin
MaWeRic29-Apr-08 4:59
MaWeRic29-Apr-08 4:59 
AnswerRe: How to write a help-assistant like office Assistant? Pin
Zaegra29-Apr-08 8:41
Zaegra29-Apr-08 8:41 
GeneralRe: How to write a help-assistant like office Assistant? Pin
MaWeRic4-May-08 22:47
MaWeRic4-May-08 22:47 
Questionreceive file names sent to your application Pin
Member 467598629-Apr-08 2:29
Member 467598629-Apr-08 2:29 
GeneralCP MEMBERS: IGNORE QUESTION Pin
leckey29-Apr-08 6:51
leckey29-Apr-08 6:51 
GeneralServer was unable to process request. ---&gt; System.InvalidCastException Pin
Nitin198129-Apr-08 0:48
Nitin198129-Apr-08 0:48 
GeneralRe: Server was unable to process request. ---&gt; System.InvalidCastException Pin
Mycroft Holmes29-Apr-08 1:41
professionalMycroft Holmes29-Apr-08 1:41 
Generalgetting reports from your app (best practises are there any how do you do it?) Pin
GDMFSOB29-Apr-08 0:35
GDMFSOB29-Apr-08 0:35 
GeneralRe: getting reports from your app (best practises are there any how do you do it?) Pin
Mycroft Holmes29-Apr-08 1:45
professionalMycroft Holmes29-Apr-08 1:45 
QuestionIssue related to C1.Win.FlexGrid (Please answer only if u have worked on C1.FlexGrid) Pin
Dot Net Jantu29-Apr-08 0:01
Dot Net Jantu29-Apr-08 0:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.