Click here to Skip to main content
15,896,201 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralView Word Document in Vb.Net Form Visual Studio 2012 Pin
Danish198711-Feb-14 1:02
Danish198711-Feb-14 1:02 
GeneralRe: View Word Document in Vb.Net Form Visual Studio 2012 Pin
Richard Deeming11-Feb-14 1:13
mveRichard Deeming11-Feb-14 1:13 
GeneralRe: View Word Document in Vb.Net Form Visual Studio 2012 Pin
Danish198711-Feb-14 1:24
Danish198711-Feb-14 1:24 
GeneralRe: View Word Document in Vb.Net Form Visual Studio 2012 Pin
Eddy Vluggen11-Feb-14 3:02
professionalEddy Vluggen11-Feb-14 3:02 
QuestionPrintPreviewControl at Zoom In Page Right and Bottom Margin Spaces Not Appear?? Pin
Nicomendox10-Feb-14 10:33
Nicomendox10-Feb-14 10:33 
QuestionSms in Vb.net Pin
sadish69-Feb-14 19:59
sadish69-Feb-14 19:59 
AnswerRe: Sms in Vb.net Pin
Chris Quinn9-Feb-14 21:14
Chris Quinn9-Feb-14 21:14 
QuestionSelect statement with checkbox Pin
Gentry_389-Feb-14 17:48
Gentry_389-Feb-14 17:48 
I'm trying to run a sql statement and the parameters are based on date range and an item if the checkbox is checked. So far I get the right query result if the checkbox is checked but without it I'm getting "Command parameter 2 is invalid". Any help is appreciated. Thanks!

Code:
VB
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim sqlsearch As String
        Dim con As New OleDb.OleDbConnection
        Dim date1 As String = DateTimePicker2.Value.ToShortDateString()
        date1 = date1 + " 00:00:00"
        Dim date2 As String = DateTimePicker3.Value.ToShortDateString()
        date2 = date2 + " 23:59:59"
        Dim scanner As String = ComboBox5.Text

        con.ConnectionString = "provider=SQLOLEDB;data source=myserver;database=mydb;user ID=user;password=mypassword;"
        ' Once again we execute the SQL statements against our DataBase

        If CheckBox1.CheckState = CheckState.Checked Then
            sqlsearch = "SELECT TOP(200) hw_name,[type],[status],wh_function,[user],check_out_date FROM tran_log WHERE check_out_date BETWEEN ? AND ? AND hw_name = ? order by check_out_date desc"
        Else : CheckBox1.CheckState = CheckState.Unchecked
            sqlsearch = "SELECT TOP(200) hw_name,[type],[status],wh_function,[user],check_out_date FROM tran_log WHERE check_out_date BETWEEN ? AND ? order by check_out_date desc"
        End If
        Dim adapter As New OleDbDataAdapter(sqlsearch, con)
        With adapter.SelectCommand.Parameters
            .AddWithValue("@startDate", date1)
            .AddWithValue("@endDate", date2)
            .AddWithValue("@scanner", scanner)
        End With

        ' Shows the records and updates the DataGridView

        Dim dt As New DataTable("ScannerHistory")

        adapter.Fill(dt) -- "This is where I'm getting the error."
        DataGridView1.DataSource = dt
    End Sub

AnswerRe: Select statement with checkbox Pin
Mycroft Holmes9-Feb-14 17:56
professionalMycroft Holmes9-Feb-14 17:56 
GeneralRe: Select statement with checkbox Pin
Gentry_389-Feb-14 18:23
Gentry_389-Feb-14 18:23 
GeneralRe: Select statement with checkbox Pin
Gentry_389-Feb-14 18:29
Gentry_389-Feb-14 18:29 
QuestionEmbed VLC in VB.net 2008 Express Edition Pin
Almas Akhtr9-Feb-14 3:16
Almas Akhtr9-Feb-14 3:16 
AnswerRe: Embed VLC in VB.net 2008 Express Edition Pin
Dave Kreskowiak9-Feb-14 4:57
mveDave Kreskowiak9-Feb-14 4:57 
Questionlinking multiple tables(3 or more tables) using sql select query in vb6 Pin
Member 102487687-Feb-14 0:32
Member 102487687-Feb-14 0:32 
AnswerRe: linking multiple tables(3 or more tables) using sql select query in vb6 Pin
Dave Kreskowiak7-Feb-14 7:44
mveDave Kreskowiak7-Feb-14 7:44 
AnswerRe: linking multiple tables(3 or more tables) using sql select query in vb6 Pin
Tim Carmichael7-Feb-14 7:53
Tim Carmichael7-Feb-14 7:53 
SuggestionRe: linking multiple tables(3 or more tables) using sql select query in vb6 Pin
Mycroft Holmes8-Feb-14 13:25
professionalMycroft Holmes8-Feb-14 13:25 
GeneralRe: linking multiple tables(3 or more tables) using sql select query in vb6 Pin
SoMad8-Feb-14 13:53
professionalSoMad8-Feb-14 13:53 
GeneralRe: linking multiple tables(3 or more tables) using sql select query in vb6 Pin
Mycroft Holmes8-Feb-14 16:23
professionalMycroft Holmes8-Feb-14 16:23 
GeneralRe: linking multiple tables(3 or more tables) using sql select query in vb6 Pin
Eddy Vluggen8-Feb-14 23:58
professionalEddy Vluggen8-Feb-14 23:58 
QuestionInsert ComboBox records into SQL table Pin
Gentry_386-Feb-14 12:34
Gentry_386-Feb-14 12:34 
AnswerRe: Insert ComboBox records into SQL table Pin
Richard Deeming7-Feb-14 1:41
mveRichard Deeming7-Feb-14 1:41 
GeneralRe: Insert ComboBox records into SQL table Pin
Gentry_387-Feb-14 10:12
Gentry_387-Feb-14 10:12 
GeneralRe: Insert ComboBox records into SQL table Pin
Richard Deeming7-Feb-14 10:48
mveRichard Deeming7-Feb-14 10:48 
GeneralRe: Insert ComboBox records into SQL table Pin
Gentry_388-Feb-14 10:06
Gentry_388-Feb-14 10:06 

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.