Hi all
I was asked from the company i support their intranet with asp to create a vb prog in order to retrive magazine circulations from their oracle server and update the number of circulations if needed to be corrected.
After searching a lot the web i have come up with the following code, apart from the date selection criteria, that works in retrieving and displaying the data as i was asked to do:
-
Dim SrText As String = ""
-
Dim SrDate As Date
-
Dim RtnYear As Integer
-
Dim I As Integer
-
Dim MyReader As OracleDataReader
-
'[VS1].C1FlexGrid.flexDMBoundImmediate[=3]
-
'VS1.Bound=0
-
-
Sub FillGrid()
-
Year()
-
Dim StrMedia As String = ""
-
-
Dim MySelect = _
-
"SELECT tbl_media.media_id, media_descr, media_categories_id, " _
-
& " mi_yearmonth, mi_date, mi_circulation, mi_id " _
-
& " FROM tbl_media, tbl_media_issue " _
-
& " WHERE tbl_media.media_id = tbl_media_issue.media_id " _
-
& " AND (Tbl_Media.Media_Categories_ID = 2 OR Tbl_Media.Media_Categories_ID = 3)" _
-
& " AND Tbl_Media_Issue.MI_Yearmonth = " & RtnYear & " AND Tbl_Media.Media_Descr like '%" & SrText & "%' AND mi_circulation IS NOT NULL ORDER BY tbl_media.media_id, mi_yearmonth"
-
-
Dim MyCommand As New OracleCommand(MySelect, OracleCon)
-
-
Try
-
-
MyReader = MyCommand.ExecuteReader
-
-
Me.VS1.Clear(C1.Win.C1FlexGrid.ClearFlags.All)
-
Me.VS1.Rows.Count = 1
-
Me.VS1.Cols.Count = 1
-
Me.VS1.Cols(0).Width = 15
-
-
FillData(MyReader)
-
Me.VS1.AutoSizeCols()
-
Me.Refresh()
-
Catch ex As Exception
-
MessageBox.Show(ex.ToString, "FillGrid")
-
End Try
-
End Sub
-
-
Private Sub MFileExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MFileExit.Click
-
End
-
End Sub
-
-
Private Sub Text1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Text1.TextChanged
-
SrText = Text1.Text
-
End Sub
-
The select year function goes here
-
Private Sub Btn1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn1.Click
-
FillGrid()
-
End Sub
-
-
Sub FillData(ByVal MyReader As OracleDataReader)
-
I = 0
-
Dim StrMedia As String
-
-
VS1.Cols.Add()
-
VS1.Cols(VS1.Cols.Count - 1).Caption = "Κωδικός"
-
VS1.Cols(VS1.Cols.Count - 1).Name = "Κωδικός"
-
-
VS1.Cols.Add()
-
VS1.Cols(VS1.Cols.Count - 1).Caption = "Ονομασία"
-
VS1.Cols(VS1.Cols.Count - 1).Name = "Ονομασία"
-
-
VS1.Cols.Add()
-
VS1.Cols(VS1.Cols.Count - 1).Caption = "Ημερομηνία"
-
VS1.Cols(VS1.Cols.Count - 1).Name = "Ημερομηνία"
-
-
VS1.Cols.Add()
-
VS1.Cols(VS1.Cols.Count - 1).Caption = "Κυκλοφορίες"
-
VS1.Cols(VS1.Cols.Count - 1).Name = "Κυκλοφορίες"
-
-
Try
-
While MyReader.Read
-
I = I + 1
-
Me.VS1.Rows.Add()
-
Me.VS1(Me.VS1.Rows.Count - 1, Me.VS1.Cols("Κωδικός").Index) = MyReader("MI_ID")
-
Me.VS1(Me.VS1.Rows.Count - 1, Me.VS1.Cols("Ονομασία").Index) = MyReader("MEDIA_DESCR")
-
Me.VS1(Me.VS1.Rows.Count - 1, Me.VS1.Cols("Ημερομηνία").Index) = MyReader("MI_DATE")
-
Me.VS1(Me.VS1.Rows.Count - 1, Me.VS1.Cols("Κυκλοφορίες").Index) = MyReader("MI_CIRCULATION")
-
End While
-
Catch ex As Exception
-
MessageBox.Show(ex.ToString, "FillData")
-
End Try
-
End Sub
-
-
Private Sub VS1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles VS1.Click
-
-
End Sub
-
End Class
I would like some help with the update statement since i can't find anything in the web that works with the software versions i am using.
In particular i want to match the first row with the table's id number and then update the circulation number for that id. the records in the field can be many depending on the search the user uses.
Thank you in advance
Yours Sincerely
ick