VB.NET:
Private Sub Woodstock_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim connection As New SqlClient.SqlConnection("Data Source=server;Initial Catalog=umrdashboard;Persist Security Info=True;User ID=userid;Password=password")
Dim command As New SqlClient.SqlCommand
Dim adapter As New SqlClient.SqlDataAdapter
Dim dataset As New DataSet
command.CommandText = "SELECT * FROM dateprolog WHERE Office='Woodstock' AND Date='" & Date.Now & "'"
connection.Open()
command.Connection = connection
adapter.SelectCommand = command
adapter.Fill(dataset, "0")
Dim count = dataset.Tables(0).Rows.Count
If count > 0 Then
MsgBox("A report has already been started for today. Please select the End Of Day tab to view what is left.", vbOKOnly)
connection.Close()
Else
MsgBox("There is not a Report started for today! I have started one for you.", vbOKOnly, "New Day Opened")
command.Connection = connection
command.CommandText = "INSERT INTO dateprolog (Office, Date, PC, UF, EMS, PT, EMP, UNITS, FS, EOD) VALUES ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j')"
Try
connection.Open()
command.ExecuteNonQuery()
connection.Close()
Catch ex As Exception
MsgBox("Error")
End Try
End If
End Sub
I not getting a program error code but it is not inserting the new row into dateprolog database.