Question Payroll project

shekhar upreti

New member
Joined
Mar 8, 2012
Messages
3
Programming Experience
1-3
Hi,
I am using VB.Net with MS Access database,
Have created Payroll project, I have added 250 Emp details,
That details I am using in another form for attendance and Salary,
Through Emp No set Combobox and fetching required details of employee one by one,
add some more details and store them in to related table.
But what issue I faces is I can only fetch 170 employee details in Combobox out of 250 emp details I have added.
 
You certainly can fetch more than 170 records. If you are trying and it's not working then you are doing something wrong. As you have shown us what you're doing or explained exactly what happens when you do, we can't really help you fix the problem.
 
Thank you, for showing interest in my problem,
Actually I am getting all Employee Nos in Emp No Combobox from EmpNo Column of EmployeeDetails table.
Now on selection of EmpNo through Combobox that Employee details display in the related Textboxes.
And then I add some more details in another Text boxes ,of that form and then save them in to another table(i.e Attendance, Salary).
So issue I am facing is only 170 Employee Nos I m getting in that Combobox even I tried DataGridView in that control also,
I was getting 170 Emp details out of 250 Employees details I have in Employee Details table.​
 
Hello

This may be a stupid question but have you checked that your sql select statement is correct and that all the data required corresponds to the select statement, because it sounds like it could be something like that.
 
If you're only retrieving 170 records then it's because you're only retrieving 170 records. It has nothing to do with the ComboBox. Show us the code that you use to retrieve the data.
 
Private Sub frmEmpCode_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
cnn =
New OleDb.OleDbConnection
cnn.ConnectionString =
"Provider=Microsoft.Jet.Oledb.4.0; Data Source=" & _
Application.StartupPath &
"\Payroll.mdb"
Dim da As New OleDb.OleDbDataAdapter("SELECT empNo FROM EmpDetails", cnn)
Dim dt As New DataTable
da.Fill(dt)
For i As Integer = 0 To dt.Rows.Count - 1
Me.cmbEmpNo.Items.Add(dt.Rows(i))
Next
Me.cmbEmpNo.DisplayMember = "empNo"
Me.cmbEmpNo.ValueMember = "empNo"
Me.cmbEmpNo.DataSource = dt
cnn.Close()

Me.RefreshData()
End Sub
 
First up, why are you adding all the items to the ComboBox directly and then binding the table too? It's an either/or decision.

As for the issue, what value does Fill return?

By the way, this:
cnn.ConnectionString = "Provider=Microsoft.Jet.Oledb.4.0; Data Source=" & _
Application.StartupPath & "\Payroll.mdb"
should be this:
cnn.ConnectionString = "Provider=Microsoft.Jet.Oledb.4.0; Data Source=|DataDirectory|\Payroll.mdb"
and I strongly suggest that you store your connection string in the config file.
 
Back
Top