Featured

C.L.S.T.I.. Powered by Blogger.
Showing posts with label Programming NC IV. Show all posts
Showing posts with label Programming NC IV. Show all posts

0 Types of Queries

Types of Queries

    1. Select Query – selects a group of records from one or more tables and displays the result in a datasheet where you can update records.
    2. Cross-tab Query – group data into categories and displays values in a compact, spreadsheet-like format with summary totals.
    3. Parameter Query – a query that when run displays a dialog box prompting you for information such as criteria for retrieving records or a value.
    4. Action Query – makes changes to many records in just one operation. There are four types of action queries: make table, delete, append and update.
    5. SQL Query – query you create using an SQL statement.

  1. Select -Select Query
  2. Crosstab -Cross-tab Query
  3. Make Table - Action Query
  4. Append - Action Query
  5. Update - Action Query
  6. Delete - Action Query
  7. Union - SQL Query
  8. Pass-Through - SQL Query
  9. Data Definition - SQL Query
Read more

0 fscanf and feof

Read more

0 fgets

Read more

0 fprintf

Read more

0 fopen - part2

Read more

0 fopen - part1

Read more

0 string functions

Read more

0 functions

Read more

0 arrays

Read more

0 do while

Read more

0 for loop

Read more

0 switch

Read more

0 nested if

Read more

0 if statement

Read more

0 define

Read more

0 scanf

Read more

0 Printf

Read more

0 ADO - Delete

Private Sub cmdDelete_Click()
   
    On Error GoTo ERR_MAIN

    Dim objRS As ADODB.Recordset
   
    Set objConn = New ADODB.Connection
    Set objRS = New ADODB.Recordset
   
    ''1 CONNECT TO THE DATA SOURCE
    If Me.chkOracle Then
        objConn.ConnectionString = "Provider=OraOLEDB.Oracle;Data Source=yti;" & _
                             "User ID=scott;Password=tiger;"
    Else
        objConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
                     "Data Source=C:\JPI\11th Batch Training\dbMSAccess.mdb"
    End If
                
    objConn.Open
   
    ''2 OPEN RECORDSET
    With objRS
       
        .Open "SELECT * FROM EMP WHERE DEPTNO=40", objConn, adOpenKeyset, adLockOptimistic
       
        ''The Recordcount property is used to return the number of records in the recordset.
'        If .RecordCount > 0 Then
       
            ''MoveFirst - Moves the cursor to the first record in the recordset
            .MoveFirst

            Do Until .EOF
               
                ''Set the new salary - To accept the changes
                .Delete
               
                ''MoveNext - Moves the cursor to the next record in the recordset
                .MoveNext
            Loop
           
'        End If
                                   
        ''Close the recordset
        .Close
   
    End With
   
    objConn.Close
    Exit Sub
   
ERR_MAIN:
    MsgBox Err.Number & " : " & Err.Description
End Sub

Private Sub cmdCommit_Click()
    objConn.CommitTrans
    objConn.Close
End Sub

Private Sub cmdRollback_Click()
    objConn.RollbackTrans
    objConn.Close
End Sub
Read more

0 ADO - Update

Private Sub cmdUPDATE_Click()
   
    On Error GoTo ERR_MAIN

    Dim objRS As ADODB.Recordset
   
    Set objConn = New ADODB.Connection
    Set objRS = New ADODB.Recordset
   
    ''1 CONNECT TO THE DATA SOURCE
    If Me.chkOracle Then
        objConn.ConnectionString = "Provider=OraOLEDB.Oracle;Data Source=yti;" & _
                             "User ID=scott;Password=tiger;"
    Else
        objConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
                     "Data Source=C:\JPI\11th Batch Training\dbMSAccess.mdb"
    End If
                
    objConn.Open
   
    objConn.BeginTrans
   
    ''2 OPEN RECORDSET
    With objRS
       
        .Open "SELECT * FROM EMP WHERE DEPTNO=40", objConn, adOpenKeyset, adLockOptimistic
       
        ''The Recordcount property is used to return the number of records in the recordset.
'        If .RecordCount > 0 Then
       
            ''MoveFirst - Moves the cursor to the first record in the recordset
            .MoveFirst
           
            Do Until .EOF
                ''Set the new salary - To accept the changes
                .Update Array("SAL"), _
                        Array(.Fields("SAL").Value + 500)
               
                ''MoveNext - Moves the cursor to the next record in the recordset
                .MoveNext
            Loop
           
'        End If
           
        ''Close the recordset
        .Close
   
    End With
   
'    objConn.Close
    Exit Sub
   
ERR_MAIN:
    MsgBox Err.Number & " : " & Err.Description
End Sub
Read more

0 ADO - Add

Private Sub cmdADD_Click()
   
    On Error GoTo ERR_MAIN

    Dim objRS As ADODB.Recordset
    Dim intI As Integer
    Dim strFields
    Dim strValues
   
    Set objConn = New ADODB.Connection
    Set objRS = New ADODB.Recordset
   
    ''1 CONNECT TO THE DATA SOURCE
    If Me.chkOracle Then
        objConn.ConnectionString = "Provider=OraOLEDB.Oracle;Data Source=yti;" & _
                             "User ID=scott;Password=tiger;"
    Else
        objConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
                     "Data Source=C:\JPI\11th Batch Training\dbMSAccess.mdb"
    End If
                
    objConn.Open

    ''2 OPEN RECORDSET
    With objRS
       
        .Open "EMP", objConn, adOpenKeyset, adLockOptimistic
       
        For intI = 1 To 2
            strFields = Array("EMPNO", "ENAME", "JOB", "MGR", "HIREDATE", "SAL", "COMM", "DEPTNO")
            strValues = Array(9997 + intI, "EDMON" & CStr(intI), "ANALYST", 7566, #4/1/2002#, 1000 * intI, 500 * intI, 40)
           
            ''Tell Access that we want to be in "add" mode
            .AddNew strFields, strValues
                        
            ''To accept new record
            .Update
        Next
       
        ''Close the recordset
        .Close
   
    End With
   
    objConn.Close
    Exit Sub
   
ERR_MAIN:
    MsgBox Err.Number & " : " & Err.Description
End Sub
Read more

Delete this element to display blogger navbar

 
© C.L.S.T.I. Tutorial | Design by Blog template in collaboration with Concert Tickets, and Menopause symptoms
Powered by Blogger