Click here to Skip to main content
16,005,120 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: In need of help on VB Pin
Dave Kreskowiak8-Feb-11 13:36
mveDave Kreskowiak8-Feb-11 13:36 
GeneralRe: In need of help on VB Pin
Dwayne J. Baldwin8-Feb-11 13:53
Dwayne J. Baldwin8-Feb-11 13:53 
GeneralRe: In need of help on VB Pin
Dave Kreskowiak8-Feb-11 15:40
mveDave Kreskowiak8-Feb-11 15:40 
AnswerRe: In need of help on VB Pin
popkutty10-Feb-11 17:16
popkutty10-Feb-11 17:16 
AnswerRe: In need of help on VB Pin
hugoguan25-May-11 23:06
hugoguan25-May-11 23:06 
QuestionAdd two field from database to combobox Pin
ivo755-Feb-11 3:53
ivo755-Feb-11 3:53 
AnswerRe: Add two field from database to combobox Pin
Dave Kreskowiak5-Feb-11 8:20
mveDave Kreskowiak5-Feb-11 8:20 
QuestionSub routine not working Pin
Doug Ancil4-Feb-11 5:32
Doug Ancil4-Feb-11 5:32 
I have the following sub routine

VB
 Private Sub Exceptionquery()
        Dim connection As System.Data.SqlClient.SqlConnection
        Dim connectionString As String = "Initial Catalog=mdr;Data Source=xxxxx;uid=xxxxx;password=xxxxx"
        Dim _sql As String = "SELECT [Exceptions].Employeenumber,[Exceptions].exceptiondate, [Exceptions].starttime, [exceptions].endtime, [Exceptions].code, datediff(minute, starttime, endtime)  as duration INTO scratchpad3 " + _
        "FROM [Exceptions]" + _
        "where [Exceptions].exceptiondate between @payperiodstartdate and payperiodenddate" + _
"GROUP BY [Exceptions].Employeenumber, [Exceptions].Exceptiondate, [Exceptions].starttime, [exceptions].endtime," + _
"[Exceptions].code, [Exceptions].exceptiondate"
        connection = New SqlConnection(connectionString)
        connection.Open()
        Dim _CMD As SqlCommand = New SqlCommand(_sql, connection)
        _CMD.Parameters.AddWithValue("@payperiodstartdate", payperiodstartdate)
        _CMD.Parameters.AddWithValue("@payperiodenddate", payperiodenddate)
        Try
            connection.Close()
        Catch ex As Exception
            connection.Close()
        End Try
    End Sub
    Private Sub exceptionsButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles exceptionsButton.Click
        Exceptionquery()
        Dim connection As System.Data.SqlClient.SqlConnection
        Dim adapter As System.Data.SqlClient.SqlDataAdapter = New System.Data.SqlClient.SqlDataAdapter
        Dim connectionString As String = "Initial Catalog=mdr;Data Source=xxxxx;uid=xxxxx;password=xxxxx"
        Dim ds As New DataSet
        Dim _sql As String = "SELECT * from scratchpad3"
        connection = New SqlConnection(connectionString)
        connection.Open()
        Dim _CMD As SqlCommand = New SqlCommand(_sql, connection)
        _CMD.Parameters.AddWithValue("@payperiodstartdate", payperiodstartdate)
        _CMD.Parameters.AddWithValue("@payperiodenddate", payperiodenddate)
        adapter.SelectCommand = _CMD
        Try
            adapter.Fill(ds)
            If ds Is Nothing OrElse ds.Tables.Count = 0 OrElse ds.Tables(0).Rows.Count = 0 Then
                'it's empty
                MessageBox.Show("There was no data for this time period. Press Ok to continue", "No Data")
                connection.Close()
                Exceptions.saveButton.Enabled = False
                Exceptions.Hide()
                Exceptions.Show()
            Else
                connection.Close()
                Exceptions.Show()
            End If

        Catch ex As Exception
            MessageBox.Show(ex.ToString)
            connection.Close()
        End Try
    End Sub


and when I run my code, my subroutine is not being fired off. I know that because I would have a scratchpad3 in my sql database. I know that I'm probably missing something simple, but can anyone tell me what I may be missing?

Thank you

Doug
AnswerRe: Sub routine not working Pin
riced4-Feb-11 6:08
riced4-Feb-11 6:08 
GeneralRe: Sub routine not working Pin
Doug Ancil4-Feb-11 7:51
Doug Ancil4-Feb-11 7:51 
GeneralRe: Sub routine not working Pin
ChandraRam4-Feb-11 9:53
ChandraRam4-Feb-11 9:53 
GeneralRe: Sub routine not working Pin
Doug Ancil4-Feb-11 10:57
Doug Ancil4-Feb-11 10:57 
GeneralRe: Sub routine not working Pin
riced4-Feb-11 11:40
riced4-Feb-11 11:40 
GeneralRe: Sub routine not working Pin
riced4-Feb-11 11:48
riced4-Feb-11 11:48 
GeneralRe: Sub routine not working Pin
Doug Ancil7-Feb-11 4:22
Doug Ancil7-Feb-11 4:22 
AnswerRe: Sub routine not working Pin
Luc Pattyn7-Feb-11 4:34
sitebuilderLuc Pattyn7-Feb-11 4:34 
GeneralRe: Sub routine not working Pin
Doug Ancil7-Feb-11 4:45
Doug Ancil7-Feb-11 4:45 
GeneralRe: Sub routine not working Pin
Luc Pattyn7-Feb-11 5:07
sitebuilderLuc Pattyn7-Feb-11 5:07 
GeneralRe: Sub routine not working Pin
Doug Ancil7-Feb-11 5:22
Doug Ancil7-Feb-11 5:22 
GeneralRe: Sub routine not working Pin
riced7-Feb-11 9:43
riced7-Feb-11 9:43 
Questionocx control tabctl32 on a windows 7 Pin
omlac3-Feb-11 20:50
omlac3-Feb-11 20:50 
AnswerRe: ocx control tabctl32 on a windows 7 Pin
Dave Kreskowiak4-Feb-11 8:09
mveDave Kreskowiak4-Feb-11 8:09 
QuestionDon't allow notifyIcon to be hidden Pin
LCARS x323-Feb-11 6:55
LCARS x323-Feb-11 6:55 
AnswerRe: Don't allow notifyIcon to be hidden Pin
Luc Pattyn3-Feb-11 7:03
sitebuilderLuc Pattyn3-Feb-11 7:03 
GeneralRe: Don't allow notifyIcon to be hidden Pin
LCARS x323-Feb-11 7:26
LCARS x323-Feb-11 7:26 

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.