Click here to Skip to main content
14,842,225 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: VB.NET/MS ACCESS Saving today's date produces 2020-02-25 08:28:00.946341400 Pin
Richard MacCutchan25-Feb-20 21:09
mveRichard MacCutchan25-Feb-20 21:09 
QuestionRe: VB.NET/MS ACCESS Saving today's date produces 2020-02-25 08:28:00.946341400 Pin
ZurdoDev28-Feb-20 6:55
professionalZurdoDev28-Feb-20 6:55 
AnswerRe: VB.NET/MS ACCESS Saving today's date produces 2020-02-25 08:28:00.946341400 Pin
phil.o25-Feb-20 8:24
mvephil.o25-Feb-20 8:24 
AnswerRe: VB.NET/MS ACCESS Saving today's date produces 2020-02-25 08:28:00.946341400 Pin
Mycroft Holmes25-Feb-20 11:44
professionalMycroft Holmes25-Feb-20 11:44 
QuestionVB.NET/MS ACCESS Display data from query Pin
Member 1186689321-Feb-20 3:05
MemberMember 1186689321-Feb-20 3:05 
AnswerRe: VB.NET/MS ACCESS Display data from query Pin
Richard Deeming21-Feb-20 3:40
mveRichard Deeming21-Feb-20 3:40 
GeneralRe: VB.NET/MS ACCESS Display data from query Pin
Member 1186689321-Feb-20 4:10
MemberMember 1186689321-Feb-20 4:10 
AnswerRe: VB.NET/MS ACCESS Display data from query Pin
Member 1186689321-Feb-20 4:39
MemberMember 1186689321-Feb-20 4:39 
This is how I fixed with help from a post on an another site. I do have one question though. If I comment out the first db connection - ConnDB() I get an error. Why does it need two connection to work? It makes a connection in the using command. I had setup a data table from a class I wrote to make a connection and set it up so I declare Private Access As New DBControl at the top and I can add parameters and do my additions and edits that way. I didn't know how to make that work with the existing connection to the Access DBControl so I just did another connection. Not the best but I am a beginner and don't know how to do things with more efficiency yet.

Private Sub tbStudentID2_TextChanged(sender As Object, e As EventArgs) Handles tbStudentID2.TextChanged
        mySql = "SELECT DateDiff('d', [DateofRank], [currentDate]) FROM StudentData"
        '"SELECT DateDiff('d', [DateofRank], [currentDate]) FROM StudentData WHERE id={id}"
        ConnDB()
        'myCommand = New OleDbCommand(mySql, myConnection)
        'myCommand.ExecuteNonQuery()

        Dim studentID As Integer
        If Not Integer.TryParse(tbStudentID2.Text, studentID) Then
            ' Not a valid ID
            tbDays.Text = String.Empty
        Else
            Using command As New OleDbCommand("SELECT DateDiff('d', [DateofRank], [currentDate]) FROM StudentData WHERE StudentID = @StudentID", myConnection)
                command.Parameters.AddWithValue("@StudentID", studentID)

                ConnDB()

                Dim days As Object = command.ExecuteScalar()
                tbDays.Text = If(Convert.IsDBNull(days), String.Empty, Convert.ToString(days))
            End Using


            ' ADD PARAMETERS - ORDER MATTERS !!!
            Access.AddParam("@TIG", tbDays.Text)
            Access.AddParam("@SID", tbStudentID2.Text)

            ' RUN COMMAND
            Access.ExecQuery("UPDATE StudentData " &
                             "SET TimeinGrade=@TIG " &
                             "WHERE StudentID=@SID")

            ' REPORT & ABORT ON ERRORS
            If NoErrors(True) = False Then Exit Sub
        End If
    End Sub

QuestionVB.NET/MS ACCESS Fill column and all entries in the that column with the current date Pin
Member 1186689320-Feb-20 4:14
MemberMember 1186689320-Feb-20 4:14 
AnswerRe: VB.NET/MS ACCESS Fill column and all entries in the that column with the current date Pin
ZurdoDev20-Feb-20 4:23
professionalZurdoDev20-Feb-20 4:23 
GeneralRe: VB.NET/MS ACCESS Fill column and all entries in the that column with the current date Pin
Member 1186689320-Feb-20 4:44
MemberMember 1186689320-Feb-20 4:44 
AnswerRe: VB.NET/MS ACCESS Fill column and all entries in the that column with the current date Pin
ZurdoDev20-Feb-20 5:28
professionalZurdoDev20-Feb-20 5:28 
AnswerRe: VB.NET/MS ACCESS Fill column and all entries in the that column with the current date Pin
Richard MacCutchan20-Feb-20 4:58
mveRichard MacCutchan20-Feb-20 4:58 
GeneralRe: VB.NET/MS ACCESS Fill column and all entries in the that column with the current date Pin
Member 1186689320-Feb-20 5:39
MemberMember 1186689320-Feb-20 5:39 
GeneralRe: VB.NET/MS ACCESS Fill column and all entries in the that column with the current date Pin
Dave Kreskowiak20-Feb-20 7:13
mveDave Kreskowiak20-Feb-20 7:13 
GeneralRe: VB.NET/MS ACCESS Fill column and all entries in the that column with the current date Pin
Member 1186689320-Feb-20 5:42
MemberMember 1186689320-Feb-20 5:42 
QuestionHow to create new DateTime of months, going back 12 months Pin
jkirkerx17-Feb-20 8:32
professionaljkirkerx17-Feb-20 8:32 
AnswerRe: How to create new DateTime of months, going back 12 months [it works] Pin
jkirkerx17-Feb-20 8:52
professionaljkirkerx17-Feb-20 8:52 
AnswerRe: How to create new DateTime of months, going back 12 months Pin
Richard Deeming18-Feb-20 2:20
mveRichard Deeming18-Feb-20 2:20 
GeneralRe: How to create new DateTime of months, going back 12 months Pin
jkirkerx18-Feb-20 7:18
professionaljkirkerx18-Feb-20 7:18 
GeneralRe: How to create new DateTime of months, going back 12 months Pin
Richard Deeming18-Feb-20 7:42
mveRichard Deeming18-Feb-20 7:42 
QuestionHOW TO CREATE RDLC REPORT AND CALL IN VS 2013 Pin
Member 146289475-Feb-20 0:39
MemberMember 146289475-Feb-20 0:39 
AnswerRe: HOW TO CREATE RDLC REPORT AND CALL IN VS 2013 Pin
Richard MacCutchan5-Feb-20 2:11
mveRichard MacCutchan5-Feb-20 2:11 
QuestionMS Acces Form (VBA) - Listview to Textbox etc Pin
Jayvee Pacanza1-Feb-20 17:35
MemberJayvee Pacanza1-Feb-20 17:35 
QuestionRe: MS Acces Form (VBA) - Listview to Textbox etc Pin
Richard MacCutchan1-Feb-20 21:32
mveRichard MacCutchan1-Feb-20 21:32 

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.