(Menampilkan Data Menggunakan Store Procedure dan RecordSet di VB6)
Private Sub GetDetailUser(UserID As String) Dim cn As ADODB.Connection Dim rs As ADODB.Recordset Dim cm As ADODB.Command Dim sql As String Set cn = New ADODB.Connection 'Important to set new or u'll get an error Set cm = New ADODB.Command Set rs = New ADODB.Recordset cn.Open (ActiveCn) 'ActiveCN = Connection String With cm .ActiveConnection = cn .CommandType = adCmdStoredProc .CommandText = "[databasename]..spGetUserDetail" 'Create Parameter .Parameters.Append .CreateParameter("@UserID", adBigInt, adParamInput, , Val(UserID)) End With Set rs = cm.Execute With Text1 If Not rs.EOF Then 'Do Not User rs.RecordCount .Text = rs!Name & "" & vbNewLine .Text = rs!Position & "" & vbNewLine End If End With Set cm = Nothing Set rs = Nothing Set cn = Nothing End Sub
0 comments:
Post a Comment