50133 (Создание базы данных), страница 12
Описание файла
Документ из архива "Создание базы данных", который расположен в категории "". Всё это находится в предмете "информатика" из 1 семестр, которые можно найти в файловом архиве . Не смотря на прямую связь этого архива с , его также можно найти и в других разделах. Архив можно найти в разделе "курсовые/домашние работы", в предмете "информатика, программирование" в общих файлах.
Онлайн просмотр документа "50133"
Текст 12 страницы из документа "50133"
3507 Call ErrorInQuery
3508 Exit Sub
3509 End If
3510 Dim tmprow As TDBElem
3511 tmprow =. Rows(index1)
3512. Rows(index1) =. Rows(index2)
3513. Rows(index2) = tmprow
3514 End With
3515 End Select
3516End Sub
3517
3518Sub ChangeRun(what$, param$)
3519 Select Case what
3520 Case sType ' **************...::: Type:::... ***************
3521 If Not IsInteger(param) Then
3522 Call ErrorInQuery
3523 Exit Sub
3524 End If
3525 colindex% = CLng(param)
3526 If (colindex DB(QRDBIndex). Header. ColCount - 1) Then
3527 Call ErrorInQuery
3528 Exit Sub
3529 End If
3530 If (DB(QRDBIndex). Cols(colindex). Class = ccString) Then
3531 If (MsgForm. QuestMsg("Поле строкового типа преобразуется в числовой тип. " + _
3532 "Все нечисловые значения будут преобразованы в 0. " + _
3533 "Продолжить? ") <> resOk) Then Exit Sub
3534
3535 End If
3536 For i% = 0 To (DB(QRDBIndex). Header. RowCount - 1)
3537 Select Case DB(QRDBIndex). Cols(colindex). Class
3538 Case ccInteger
3539 DB(QRDBIndex). Rows(i). Fields(colindex) = CStr(DB(QRDBIndex). Rows(i). Fields(colindex))
3540 Case ccString
3541 If Not IsInteger(DB(QRDBIndex). Rows(i). Fields(colindex)) Then
3542 DB(QRDBIndex). Rows(i). Fields(colindex) = 0
3543 Else
3544 DB(QRDBIndex). Rows(i). Fields(colindex) = CLng(DB(QRDBIndex). Rows(i). Fields(colindex))
3545 End If
3546 End Select
3547 Next i
3548 Select Case DB(QRDBIndex). Cols(colindex). Class
3549 Case ccInteger
3550 DB(QRDBIndex). Cols(colindex). Class = ccString
3551 Case ccString
3552 DB(QRDBIndex). Cols(colindex). Class = ccInteger
3553 End Select
3554
3555 Case sName ' **************...::: Name:::... ***************
3556 p% = InStr(1, param, ",")
3557 If TestZero(p) Then Exit Sub
3558 colindexstr$ = Trim(Left(param, p - 1))
3559 If Not IsInteger(colindexstr) Then
3560 Call ErrorInQuery
3561 Exit Sub
3562 End If
3563 colindex% = CLng(colindexstr)
3564 param = Trim(Mid(param, p + 1))
3565 If (param = "") Then
3566 Call ErrorInQuery
3567 Exit Sub
3568 End If
3569 ' поиск на дубликат
3570 For i% = 0 To DB(QRDBIndex). Header. ColCount - 1
3571 If (DB(QRDBIndex). Cols(i). title = param) And (i <> colindex) Then
3572 Call MsgForm. ErrorMsg("Поле с названием " + param + " уже существует! ")
3573 Exit Sub
3574 End If
3575 Next i
3576 DB(QRDBIndex). Cols(colindex). title = param
3577 DB(QRDBIndex). Cols(colindex). TitleLen = Len(param)
3578 Case Default ' **************!! ***************
3579 Call ErrorInQuery
3580 End Select
3581End Sub
3582
3583Public Sub RunQuery(DBIndex_%, query$)
3584 Dim s1$, p%
3585
3586 s1 = Mid(query, 4)
3587 query = Left(query, 3)
3588
3589 QRDBIndex = DBIndex_
3590
3591 Select Case query
3592 Case sAdd
3593 query = Left(s1, 3)
3594 s1 = Mid(s1, InStr(1, s1, "("))
3595 If (Left(s1, 1) <> "(") Or (Right(s1, 1) <> ")") Or ((Len(s1) < 8) And (query = sCol)) Then
3596 Call ErrorInQuery
3597 Else
3598 Call AddRun(query, Trim(Mid(s1, 2, Len(s1) - 2)))
3599 End If
3600 Case sDel
3601 query = Left(s1, 3)
3602 s1 = Mid(s1, InStr(1, s1, "("))
3603 If (Left(s1, 1) <> "(") Or (Right(s1, 1) <> ")") Or (Len(s1) < 5) Then
3604 Call ErrorInQuery
3605 Else
3606 Call DelRun(query, Trim(Mid(s1, 2, Len(s1) - 2)))
3607 End If
3608 Case sSort
3609 If (Left(s1, 1) <> "(") Or (Right(s1, 1) <> ")") Or (Len(s1) < 5) Then
3610 Call ErrorInQuery
3611 Else
3612 Call SortRun(Trim(Mid(s1, 2, Len(s1) - 2)))
3613 End If
3614 Case sOut
3615 If (Left(s1, 1) <> "(") Or (Right(s1, 1) <> ")") Or (Len(s1) < 5) Then
3616 Call ErrorInQuery
3617 Else
3618 Call OutRun(Trim(Mid(s1, 2, Len(s1) - 2)))
3619 End If
3620 Case sSwap
3621 query = Left(s1, 3)
3622 s1 = Mid(s1, InStr(1, s1, "("))
3623 If (Left(s1, 1) <> "(") Or (Right(s1, 1) <> ")") Or ((Len(s1) < 5) And (query = sCol)) Then
3624 Call ErrorInQuery
3625 Else
3626 Call SwapRun(query, Trim(Mid(s1, 2, Len(s1) - 2)))
3627 End If
3628 Case sChange
3629 query = Left(s1, 4)
3630 s1 = Mid(s1, InStr(1, s1, "("))
3631 If (Left(s1, 1) <> "(") Or (Right(s1, 1) <> ")") Or (Len(s1) < 3) Then
3632 Call ErrorInQuery
3633 Else
3634 Call ChangeRun(query, Trim(Mid(s1, 2, Len(s1) - 2)))
3635 End If
3636 End Select
3637
3638End Sub