I have the following code in my project:
And what I'm needing to do is to show in my messagebox.show the date from the sql query that I ran before this. I know that I havent declared a variable in that statement but I'm having a bit of a lapse today and was just wondering how to show that result in my messagebox.show.
Thanks
Doug
VB.NET:
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim connectionString As String
Dim cnn As SqlConnection
Dim myCommand As SqlCommand
'the connection string to the SQL server'
connectionString = "Data Source=10.2.1.41;Initial Catalog=MDR;uid=xxxx;password=xxxxxxxx"
cnn = New SqlConnection(connectionString)
cnn.Open()
'the SQL query'
myCommand = New SqlCommand("select payrolldate from payroll where payrolldate <= getdate (), select dateadd (day, 7, Getdate())")
cnn.Close()
Dim ButtonDialogResult As DialogResult
ButtonDialogResult = MessageBox.Show("The next date available to you is", "Payroll", MessageBoxButtons.YesNo)
If ButtonDialogResult = Windows.Forms.DialogResult.Yes Then
Button2.Enabled = True
Button1.Enabled = False
End If
End Sub
End Class
And what I'm needing to do is to show in my messagebox.show the date from the sql query that I ran before this. I know that I havent declared a variable in that statement but I'm having a bit of a lapse today and was just wondering how to show that result in my messagebox.show.
Thanks
Doug