Click here to Skip to main content
15,911,890 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
AnswerRe: adding a panel to a form. Pin
Luc Pattyn22-Sep-10 17:13
sitebuilderLuc Pattyn22-Sep-10 17:13 
GeneralRe: adding a panel to a form. Pin
bimbambumbum25-Sep-10 4:46
bimbambumbum25-Sep-10 4:46 
GeneralRe: adding a panel to a form. Pin
Luc Pattyn25-Sep-10 5:21
sitebuilderLuc Pattyn25-Sep-10 5:21 
GeneralRe: adding a panel to a form. [modified] Pin
bimbambumbum25-Sep-10 5:31
bimbambumbum25-Sep-10 5:31 
GeneralRe: adding a panel to a form. Pin
Luc Pattyn25-Sep-10 6:08
sitebuilderLuc Pattyn25-Sep-10 6:08 
GeneralRe: adding a panel to a form. [modified] Pin
bimbambumbum25-Sep-10 11:20
bimbambumbum25-Sep-10 11:20 
GeneralRe: adding a panel to a form. Pin
Luc Pattyn25-Sep-10 12:02
sitebuilderLuc Pattyn25-Sep-10 12:02 
QuestionsqlDataAdapter doest not refresh the query Pin
akosidandan22-Sep-10 5:20
akosidandan22-Sep-10 5:20 
Hello Experts,

Good day/Good Evening Experts I am here again to ask some few questions. Smile | :)
I would like to ask if why does my sqldataAdapter do not refresh the query it fill my datatable.
I am making a borrow transaction for borrowing a book where in a student or ... borrow. The quantity of book will decrease depending on the quantity of book borrowed.My problem is that my sqlDataAdapter to load the table of my bookRecords does not refresh what it need to fill.Confuse Confused | :confused: why does it refresh my sql query.

Below here is my code:

'save the borrow transaction
    Public Sub SaveBorrowTransaction(ByVal txtBorrowerID As TextBox, ByVal txtLastName As TextBox, _
                                     ByVal txtFirstName As TextBox, ByVal txtMI As TextBox, _
                                    ByVal txtContactNo As TextBox, ByVal cboPosition As ComboBox, _
                                    ByVal txtYear As TextBox, ByVal txtSection As TextBox, _
                                    ByVal txtLibrarianLastName As TextBox, ByVal txtLibarianFirstName As TextBox, _
                                    ByVal txtLibrarianMI As TextBox, ByVal cboNoOfDays As ComboBox, _
                                    ByVal txtTransactionID As TextBox, _
                                    ByVal lvItems As ListView, ByVal con As SqlConnection)
        Try
            Dim dt As New DataTable
            Dim ds As New DataSet
            ds.Tables.Add(dt)
            Dim da As New SqlDataAdapter

            con.Open()
            da = New SqlDataAdapter("Select * from BorrowTransactionTable", con)
            da.Fill(dt)

            Dim dt2 As New DataTable
            Dim ds2 As New DataSet
            ds2.Tables.Add(dt2)
            Dim da2 As New SqlDataAdapter

            da2 = New SqlDataAdapter("Select * from transactionitemstable", con)
            da2.Fill(dt2)


            Dim dt3 As New DataTable
            Dim ds3 As New DataSet
            ds3.Tables.Add(dt3)
            Dim da3 As New SqlDataAdapter

            Dim j As Integer = 0


            While j <> lvItems.Items.Count

                'for borrow transaction////////////////////////////////
                Dim newRow As DataRow = dt.NewRow
                With newRow
                    .Item("txtTransactionID") = txtTransactionID.Text
                    .Item("txtBorrowerID") = txtBorrowerID.Text
                    .Item("txtLibrarianLastName") = txtLibrarianLastName.Text
                    .Item("txtLibrarianFirstName") = txtLibarianFirstName.Text
                    .Item("txtLibrarianMI") = txtLibrarianMI.Text
                    .Item("txtLastName") = txtLastName.Text
                    .Item("txtFirstName") = txtFirstName.Text
                    .Item("txtMI") = txtMI.Text
                    .Item("txtSection") = txtSection.Text
                    .Item("txtYear") = txtYear.Text
                    .Item("txtContactNo") = txtContactNo.Text
                    .Item("txtPosition") = cboPosition.Text
                    .Item("txtItemNO") = lvItems.Items(j).SubItems(0).Text
                    .Item("txtRemarks") = "Borrowed"
                    .Item("intNoDay") = Val(cboNoOfDays.Text)

                    .Item("intQuantity") = 1
                    'update changes to quantity of book catalogue records when borrowing///////////////////

                    da3 = New SqlDataAdapter("Select * from BookCatalogueTable where txtAccessionNo='" & lvItems.Items(j).SubItems(0).Text & "'", con)
                    da3.Fill(dt3)
                    dt3.Rows(0).BeginEdit()
                    dt3.Rows(0).Item("intQuantity") = Val(dt3.Rows(0).Item("intQuantity")) - 1
                    dt3.Rows(0).EndEdit()
                    Dim cb3 As New SqlCommandBuilder(da3)
                    da3.Update(dt3)


                    .Item("dateDateBorrow") = Now.Date
                    .Item("dateDueDate") = Now.AddDays(Val(cboNoOfDays.Text))
                    .Item("dateDateTransaction") = Now.Date
                End With
                dt.Rows.Add(newRow)
                Dim cb As New SqlCommandBuilder(da)
                da.Update(dt)

                'for transaction items//////////////////////////////////////
                Dim newrow2 As DataRow = dt2.NewRow
                With newRow2
                    .Item("txtTransactionNo") = txtTransactionID.Text
                    .Item("txtItemNo") = lvItems.Items(j).SubItems(0).Text
                    .Item("txtItemTitle") = lvItems.Items(j).SubItems(1).Text
                    .Item("txtItemAuthor") = lvItems.Items(j).SubItems(2).Text
                    .Item("txtItemDecription") = lvItems.Items(j).SubItems(3).Text
                    .Item("txtTransactionStatus") = "Borrow"
                End With
                dt2.Rows.Add(newrow2)
                Dim cb2 As New SqlCommandBuilder(da2)
                da2.Update(dt2)

                j = j + 1
            End While

            con.Close()

            MsgBox("Transaction is Complete")

        Catch ex As Exception
            MsgBox(ex.ToString)
            con.Close()
        End Try
    End Sub


Any Comments or Suggestion are so much appreciated.

Thanks,
Dan
AnswerRe: sqlDataAdapter doest not refresh the query Pin
Not Active22-Sep-10 7:42
mentorNot Active22-Sep-10 7:42 
GeneralRe: sqlDataAdapter doest not refresh the query Pin
akosidandan22-Sep-10 22:40
akosidandan22-Sep-10 22:40 
GeneralRe: sqlDataAdapter doest not refresh the query Pin
Not Active23-Sep-10 1:08
mentorNot Active23-Sep-10 1:08 
QuestionHow to Show Specific Records in listview Pin
akosidandan22-Sep-10 1:38
akosidandan22-Sep-10 1:38 
AnswerRe: How to Show Specific Records in listview Pin
Luc Pattyn22-Sep-10 2:23
sitebuilderLuc Pattyn22-Sep-10 2:23 
GeneralRe: How to Show Specific Records in listview Pin
akosidandan22-Sep-10 2:29
akosidandan22-Sep-10 2:29 
GeneralRe: How to Show Specific Records in listview Pin
Luc Pattyn22-Sep-10 2:47
sitebuilderLuc Pattyn22-Sep-10 2:47 
QuestionFile recovery Pin
hammerstein0522-Sep-10 0:57
hammerstein0522-Sep-10 0:57 
AnswerRe: File recovery Pin
Pete O'Hanlon22-Sep-10 1:37
mvePete O'Hanlon22-Sep-10 1:37 
GeneralMessage Removed Pin
22-Sep-10 4:23
molesworth22-Sep-10 4:23 
GeneralRe: File recovery Pin
Pete O'Hanlon22-Sep-10 4:35
mvePete O'Hanlon22-Sep-10 4:35 
GeneralRe: File recovery [modified] Pin
molesworth22-Sep-10 4:38
molesworth22-Sep-10 4:38 
AnswerRe: File recovery Pin
molesworth22-Sep-10 4:48
molesworth22-Sep-10 4:48 
GeneralRe: File recovery Pin
hammerstein0522-Sep-10 5:39
hammerstein0522-Sep-10 5:39 
Question.NET code protection Pin
cherrymotion21-Sep-10 23:09
cherrymotion21-Sep-10 23:09 
AnswerRe: .NET code protection Pin
Kubajzz22-Sep-10 3:44
Kubajzz22-Sep-10 3:44 
GeneralRe: .NET code protection Pin
harold aptroot22-Sep-10 4:41
harold aptroot22-Sep-10 4:41 

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.