thejeraldo
Well-known member
hi guys. i'm just new here at vb.net forums. so this is my first post here. hope this one will be helpful to me and i hope that i can help others too someday.
i just graduated from college and i've studied VB6 at school but not that deep. now, i'm currently learning vb.net. i have a company project called HRIS (human resource information system) and i intend on using vb.net on it. i just learned how to connect to a database and add,edit,delete records by myself thanks to some good tutorials on the internet. i don't use a wizard to connect to a database and bind it to a control. i code it.
i came across this thing called OleDBDataReader. they say its used to read data FAST. i use a dataset and fill it with the data from the dataapadter. i'm really concerned about speed issues on .net since the computer i'm using on our office doesn't run vs2008 that fast even in a dual core processor. i've barely convinced my partner that we use vb.net on it. but i'm just concerned that the dataset might run slow when the database gets filled up with 1000+ records or so. (sorry for the long introduction)
my question: can oledbdatareader replace dataset or dataadapter? which one is faster? i use a dataset to fill up a listview control. here is the code i currently use.
As you see, i posted my connectionstring and how i fill the dataset with the dataadapter and how i add a new record.
thanks in advance guys!
i just graduated from college and i've studied VB6 at school but not that deep. now, i'm currently learning vb.net. i have a company project called HRIS (human resource information system) and i intend on using vb.net on it. i just learned how to connect to a database and add,edit,delete records by myself thanks to some good tutorials on the internet. i don't use a wizard to connect to a database and bind it to a control. i code it.
i came across this thing called OleDBDataReader. they say its used to read data FAST. i use a dataset and fill it with the data from the dataapadter. i'm really concerned about speed issues on .net since the computer i'm using on our office doesn't run vs2008 that fast even in a dual core processor. i've barely convinced my partner that we use vb.net on it. but i'm just concerned that the dataset might run slow when the database gets filled up with 1000+ records or so. (sorry for the long introduction)
my question: can oledbdatareader replace dataset or dataadapter? which one is faster? i use a dataset to fill up a listview control. here is the code i currently use.
VB.NET:
Dim con As New OleDb.OleDbConnection
Dim ds As New DataSet
Dim da As New OleDb.OleDbDataAdapter
Dim cmd As New OleDb.OleDbCommand
Dim sqlemp, sqlcmd, askdel, pic, picslash(), picpath As String
Dim x, id As Integer
con.ConnectionString = "Provider=SQLNCLI;Server=MIS\SQLEXPRESS;Database=HRISdb;Initial Catalog=HRISdb;Integrated Security=SSPI;"
con.Open()
sqlemp = "SELECT * FROM employeetbl"
da = New OleDb.OleDbDataAdapter(sqlemp, con)
da.Fill(ds, "Employeetbl") 'Fill the DataSet
Private Function filllist()
'Add ListView Columns
lvw1.Columns.Add("ID", 80, HorizontalAlignment.Left)
lvw1.Columns.Add("Last Name", 100, HorizontalAlignment.Left)
lvw1.Columns.Add("First Name", 100, HorizontalAlignment.Left)
lvw1.Columns.Add("Middle Name", 100, HorizontalAlignment.Left)
lvw1.Columns.Add("Picture", 100, HorizontalAlignment.Left)
lvw1.Width = 385
'Add ListView Items and Subitems
Dim lvi As ListViewItem
For x = 0 To (ds.Tables("Employeetbl").Rows.Count - 1)
lvi = New ListViewItem
lvi.Text = ds.Tables("Employeetbl").Rows(x).Item(0)
lvi.SubItems.Add(ds.Tables("Employeetbl").Rows(x).Item(1))
lvi.SubItems.Add(ds.Tables("Employeetbl").Rows(x).Item(2))
lvi.SubItems.Add(ds.Tables("Employeetbl").Rows(x).Item(3))
lvi.SubItems.Add((ds.Tables("Employeetbl").Rows(x).Item(4)) & "")
lvw1.Items.Add(lvi)
Next x
End Function
Private Sub cmdsave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdsave.Click
lvw1.Enabled = True
cmd = New OleDb.OleDbCommand
cmd.Connection = con
sqlcmd = "INSERT INTO Employeetbl (lname,fname,mname,picture) VALUES ('" & TextBox2.Text & "','" & TextBox3.Text & "','" & TextBox4.Text & "','" & pic & "')"
cmd.CommandText = sqlcmd
cmd.ExecuteScalar()
lvw1.Items.Clear()
x = 0
lvw1.Refresh()
ds.Clear()
da.Fill(ds, "Employeetbl")
lvw1.Clear()
filllist()
sqlcmd = Nothing
End Sub
As you see, i posted my connectionstring and how i fill the dataset with the dataadapter and how i add a new record.
thanks in advance guys!