• ¡Welcome to Square Theme!
  • This news are in header template.
  • Please ignore this message.
مهمان عزیز خوش‌آمدید. ورود عضــویت


امتیاز موضوع:
  • 5 رای - 1.4 میانگین
  • 1
  • 2
  • 3
  • 4
  • 5
Title: سوال فوق فورررررررررررررري فردا امتحان دارم
حالت خطی
#10
این اولیش
اینم سورسش:
کد:
Option Explicit

Private Sub Command1_Click()
Dim dbConn As ADODB.Connection
Dim Cmd As ADODB.Command
Dim rs As ADODB.Recordset
Dim strWName As String
Dim intCount As Long

On Error GoTo ExitME
Err.Clear
Set dbConn = New ADODB.Connection
With dbConn
    .Provider = "OraOLEDB.Oracle"
    .Properties("Data Source") = "ROWELLS"
    .Properties("User Id") = "wellsadmin"
    .Properties("Password") = "roweisgood"
    .Open
End With

Set Cmd = New ADODB.Command
Set Cmd.ActiveConnection = dbConn
With Cmd
    .Parameters.Append .CreateParameter(, adVarChar, adParamOutput, 50)
    .Parameters.Append .CreateParameter(, adNumeric, adParamOutput)
End With

If dbConn.State Then
    Cmd.Properties("PLSQLRSet") = True
    Cmd.CommandType = adCmdText
    Cmd.CommandText = "{CALL WellsAdmin.WellCounting(?, ?)}"
    Set rs = Cmd.Execute()
End If
If Not rs Is Nothing Then
    Dim i As Long
    i = 0
    
    If Not rs.BOF And Not rs.EOF Then
        Do Until rs.EOF
            i = i + 1
            If i > 1 Then
                Me.MSHFlexGrid1.Rows = Me.MSHFlexGrid1.Rows + 1
            End If
            Me.MSHFlexGrid1.TextMatrix(i, 0) = rs.Fields(0).Value
            Me.MSHFlexGrid1.TextMatrix(i, 1) = rs.Fields(1).Value
            rs.MoveNext
        Loop
    End If
End If
ExitME:
If Not Cmd Is Nothing Then
    Set Cmd = Nothing
End If
If Not dbConn Is Nothing Then
    If dbConn.State Then dbConn.Close
    Set dbConn = Nothing
End If

End Sub

Private Sub Command2_Click()
Dim dbConn As ADODB.Connection
Dim Cmd As ADODB.Command
Dim rs As ADODB.Recordset
Dim lngWellID As Long

lngWellID = InputBox("WellID Number for results:", "Well ID")


On Error GoTo ExitME
Err.Clear
Set dbConn = New ADODB.Connection
With dbConn
    .Provider = "OraOLEDB.Oracle"
    .Properties("Data Source") = "ROWELLS"
    .Properties("User Id") = "wellsadmin"
    .Properties("Password") = "roweisgood"
    .Open
End With

Set Cmd = New ADODB.Command
Set Cmd.ActiveConnection = dbConn
With Cmd
    .Parameters.Append .CreateParameter(, adNumeric, adParamInput, , lngWellID)
    .Parameters.Append .CreateParameter(, adVarChar, adParamOutput, 50)
    .Parameters.Append .CreateParameter(, adNumeric, adParamOutput)
End With

If dbConn.State Then
    Cmd.Properties("PLSQLRSet") = True
    Cmd.CommandType = adCmdText
    Cmd.CommandText = "{CALL WellsAdmin.OneWellCount(?,?, ?)}"
    Set rs = Cmd.Execute()
End If
If Not rs Is Nothing Then
    
    If Not rs.BOF And Not rs.EOF Then
        Do Until rs.EOF
            MsgBox "Well Name: " & rs.Fields(0).Value & vbCrLf & "Number of Results: " & rs.Fields(1).Value & vbCrLf & "Well ID Entered: " & lngWellID
            rs.MoveNext
        Loop
        rs.Close
        Set rs = Nothing
    End If
End If

ExitME:
If Not Cmd Is Nothing Then
    Set Cmd = Nothing
End If
If Not dbConn Is Nothing Then
    If dbConn.State Then dbConn.Close
    Set dbConn = Nothing
End If


End Sub

Private Sub Form_Load()

Me.MSHFlexGrid1.TextMatrix(0, 0) = "Well Name"
Me.MSHFlexGrid1.TextMatrix(0, 1) = "Number of results"

Me.MSHFlexGrid1.ColWidth(0) = Len(Me.MSHFlexGrid1.TextMatrix(0, 0)) * 100
Me.MSHFlexGrid1.ColWidth(1) = Len(Me.MSHFlexGrid1.TextMatrix(0, 1)) * 100

End Sub
حالشو ببر اینم پروژه
http://www.vb6.us/files/tutorials/OracleExample.zip
گروه دور همی پارسی کدرز
https://t.me/joinchat/GxVRww3ykLynHFsdCvb7eg
 
پاسخ
  


پیام‌های این موضوع
RE: سوال فوق فورررررررررررررري فردا امتحان دارم - توسط Amin_Mansouri - 01-23-2012، 12:42 AM

موضوعات مشابه ...
موضوع نویسنده پاسخ بازدید آخرین ارسال
  سوال مهندسي نرم افزار bakhtiari 4 7,855 01-25-2012، 12:44 AM
آخرین ارسال: Amin_Mansouri
  سوال فورررررررررررررري bakhtiari 8 11,864 01-23-2012، 01:24 AM
آخرین ارسال: Amin_Mansouri
  سوال در مورد دلفی امیر 5 8,559 12-05-2011، 03:29 PM
آخرین ارسال: Amin_Mansouri
  سوال در مورد اوراکل poupak 3 6,825 06-23-2011، 10:29 PM
آخرین ارسال: Amin_Mansouri

پرش به انجمن:


Browsing: 2 مهمان