Гость
Целевая тема:
Создать новую тему:
Автор:
Форумы / Visual Basic [игнор отключен] [закрыт для гостей] / VB 6 и MS SQL / 3 сообщений из 3, страница 1 из 1
29.08.2004, 13:15
    #32670157
b00m3r
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
VB 6 и MS SQL
Как подканектиться с помощью VB6 к MS SQL. Зарание спасиба.
...
Рейтинг: 0 / 0
30.08.2004, 09:44
    #32670524
big-duke
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
VB 6 и MS SQL
MSDN
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
Public Sub OpenX()

   Dim cnn1 As ADODB.Connection
   Dim rstEmployees As ADODB.Recordset
   Dim strCnn As String
   Dim varDate As Variant

    ' Open connection. 
      strCnn = "Provider=sqloledb;" & _
      "Data Source=srv;Initial Catalog=pubs;User Id=sa;Password=; "
   Set cnn1 = New ADODB.Connection
   cnn1.Open strCnn
   
    ' Open employee table. 
   Set rstEmployees = New ADODB.Recordset
   rstEmployees.CursorType = adOpenKeyset
   rstEmployees.LockType = adLockOptimistic
   rstEmployees.Open "employee", cnn1, , , adCmdTable

    ' Assign the first employee record's hire date 
    ' to a variable, then change the hire date. 
   varDate = rstEmployees!hire_date
   Debug.Print "Original data"
   Debug.Print "  Name - Hire Date"
   Debug.Print "  " & rstEmployees!fName & " " & _
      rstEmployees!lName & " - " & rstEmployees!hire_date
   rstEmployees!hire_date = # 1 / 1 / 1900 #
   rstEmployees.Update
   Debug.Print "Changed data"
   Debug.Print "  Name - Hire Date"
   Debug.Print "  " & rstEmployees!fName & " " & _
      rstEmployees!lName & " - " & rstEmployees!hire_date

    ' Requery Recordset and reset the hire date. 
   rstEmployees.Requery
   rstEmployees!hire_date = varDate
   rstEmployees.Update
   Debug.Print "Data after reset"
   Debug.Print "  Name - Hire Date"
   Debug.Print "  " & rstEmployees!fName & " " & _
      rstEmployees!lName & " - " & rstEmployees!hire_date

   rstEmployees.Close
   cnn1.Close

End Sub

...
Рейтинг: 0 / 0
03.09.2004, 16:38
    #32679778
VB 6 и MS SQL
b00m3rКак подканектиться с помощью VB6 к MS SQL. Зарание спасиба.

создаёшь DATA Project на VB 6.0 и погнал...
там всё легко и просто, методы объетов похожи на ADO DC.
...
Рейтинг: 0 / 0
Форумы / Visual Basic [игнор отключен] [закрыт для гостей] / VB 6 и MS SQL / 3 сообщений из 3, страница 1 из 1
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]