_ hooray! need help for my project .. I am developing a Payroll System .. I have a Stored Procedure created using SSMS 2005 ..details:
Stored Procedure Name: Find_Emp
Command/Query=
SELECT * FROM EMP0000 INNER JOIN EMP0001 ON EMP0001.EMP_NO =EMP0000.EMP_NO WHERE EMP0000.EMP_NO=@empno
In my GUI using Visual Studio 2010, I have a ListView where the list of employee listed..
I want to call the procedure in SelectedIndexChanged Event of the ListView ..
My problem is don't have an idea how to call this procedure in visual studio 2010 .. any help please ?
It's quite complicated I think .. I am using Visual Studio 2010(vb.net) .. your code is in c# ? am I right ?
by the way here's some details:
in module:
Public Sub Recordset_Connection(ByVal nMode As Integer)
If nMode = 0 Then
RstFileRead = Nothing
RstFileRead = New ADODB.Recordset
RstFileRead.Open(strFileRead, Conn, ADODB.CursorTypeEnum.adOpenForwardOnly, ADODB.LockTypeEnum.adLockReadOnly)
ElseIf nMode = 1 Then
RstFileUpdate = Nothing
RstFileUpdate = New ADODB.Recordset
RstFileUpdate.Open(strFileUpdate, Conn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic)
End If
End Sub
in my form , I create a sub procedure like the one below:
Private Sub LoadListEmp()
Dim LvItem As New ListViewItem
ListView1.Items.Clear()
strFileRead = "TIMESHEET" : Recordset_Connection(0)
With RstFileRead
Do While Not .EOF
LvItem = New ListViewItem
LvItem = ListView1.Items.Add(.Fields("EMP_NO").Value)
LvItem.SubItems.Add(.Fields("L_NAME").Value & "," & (.Fields("F_NAME").Value))
LvItem.SubItems.Add(.Fields("DEPT").Value)
.MoveNext()
Loop
End With
End Sub
-I call this procedure in Form_Load Event so it will list the Employees in ListView with the query provided in the TIMESHEET which is a Stored Procedure..
TIMESHEET Query:
SELECT * FROM EMP0000 INNER JOIN EMP0001 ON EMP0001.EMP_NO =EMP0000.EMP_NO INNER JOIN ATT0000 ON ATT0000.EMP_NO = EMP0000.EMP_NO
I have another Stored Procedure provided with the command as below:
FIND_EMP Query:
SELECT * FROM EMP0000 INNER JOIN EMP0001 ON EMP0001.EMP_NO =EMP0000.EMP_NO INNER JOIN ATT0000 ON ATT0000.EMP_NO = EMP0000.EMP_NO WHERE EMP_0000.EMP_NO = @empno
Now I want to call the FIND_EMP Stored Procedure using Visual Studio 2010.. When I click or Select an item in ListView, how to call the FIND_EMP procedure ?
thanks!