J
JenHu
Hi experts,
I have a dataadapter and datasets. I debugged it and gave me an error
on
LName = DS.Tables("AcctInfoTble").Rows(1)("LASTNAME")
error: There is no row at position 1.
WHAT DID I DO WRONG at the following code?
Thanks.
------------------------------------------------------------------------------------------------
Public Function GenerateA(ByRef strEmpID As String, ByRef
strClientAcct As String, ByRef strAcctStatus As String, ByRef
strAddressFlag As String, ByRef strNameFlag As String)
Dim strResult As New System.Text.StringBuilder
Dim GPConnection As SqlConnection
Dim dr As SqlDataReader
Dim GPDataset As New DataSet
GPConnection = New SqlConnection("workstation id=ADMIN;packet
size=4096;user id=MaintenanceHD;data source=AMKSQL2;p" & _
"ersist security info=True;initial catalog=HFC;password=maintainme")
Dim selectCMD As SqlCommand = New SqlCommand("SELECT DDACTNUM,
LASTNAME,FRSTNAME,BRTHDATE FROM UPR00102 where EmployID=' " +
strEmpID + "'", GPConnection)
Dim GPDataAdapter As SqlDataAdapter = New SqlDataAdapter
GPDataAdapter.SelectCommand = selectCMD
Dim EfundAcct As String
Dim LName As String
Dim FName As String
Dim MName As String
Dim DOB As String
Dim Loc As String
Try
GPConnection.Open()
Dim DS As DataSet = New DataSet
GPDataAdapter.Fill(DS, "AcctInfoTble")
EfundAcct = DS.Tables("AcctInfoTble").Rows(0)("DDACTNUM")
LName = DS.Tables("AcctInfoTble").Rows(1)("LASTNAME")
FName = DS.Tables("AcctInfoTble").Rows(2)("LASTNAME")
.......more codes
--------------------------------------------------------------------------------------------
*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
I have a dataadapter and datasets. I debugged it and gave me an error
on
LName = DS.Tables("AcctInfoTble").Rows(1)("LASTNAME")
error: There is no row at position 1.
WHAT DID I DO WRONG at the following code?
Thanks.
------------------------------------------------------------------------------------------------
Public Function GenerateA(ByRef strEmpID As String, ByRef
strClientAcct As String, ByRef strAcctStatus As String, ByRef
strAddressFlag As String, ByRef strNameFlag As String)
Dim strResult As New System.Text.StringBuilder
Dim GPConnection As SqlConnection
Dim dr As SqlDataReader
Dim GPDataset As New DataSet
GPConnection = New SqlConnection("workstation id=ADMIN;packet
size=4096;user id=MaintenanceHD;data source=AMKSQL2;p" & _
"ersist security info=True;initial catalog=HFC;password=maintainme")
Dim selectCMD As SqlCommand = New SqlCommand("SELECT DDACTNUM,
LASTNAME,FRSTNAME,BRTHDATE FROM UPR00102 where EmployID=' " +
strEmpID + "'", GPConnection)
Dim GPDataAdapter As SqlDataAdapter = New SqlDataAdapter
GPDataAdapter.SelectCommand = selectCMD
Dim EfundAcct As String
Dim LName As String
Dim FName As String
Dim MName As String
Dim DOB As String
Dim Loc As String
Try
GPConnection.Open()
Dim DS As DataSet = New DataSet
GPDataAdapter.Fill(DS, "AcctInfoTble")
EfundAcct = DS.Tables("AcctInfoTble").Rows(0)("DDACTNUM")
LName = DS.Tables("AcctInfoTble").Rows(1)("LASTNAME")
FName = DS.Tables("AcctInfoTble").Rows(2)("LASTNAME")
.......more codes
--------------------------------------------------------------------------------------------
*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*