CONNECTIVITY OF SQL 2000 + VB USING ODBC.
steps i Follow-
1) Go to Control panel-->Admintrative Tools-->Double -click
Data sources(ODBC)-->click Add button-->I choose SQL server
(last option), Is it right or wrong option for connecting
to SQL 2000.Then a new screen appears Create a New
dataSource-->in name textbox,we can write anyname--Right or
wrong. suppose i enter sonia, & my server name is .,so I
enter . in server & click next button-->On the Next screen
i have checked the option With Sql server authentication--
>Login Id-sa, Password-->Blank-->Click next button-->Next--
>Finish-->Then I click on button Test Data source-->Mesage
Comes TESTS COMPLETED SUCCESSFULLY-->OK-->OK-->Ok.
These steps we have to do or not for Connectivity using
ODBC.
If yes,then what after these steps we have to do??Plz reply
me early ??Thx in advance.
Answers were Sorted based on User's Feedback
Answer / deepak g
You have to use this DSN name (in your case it is sonia) in
your VB code wherever you wish to establish a connection
between your VB application and your SQL server 2K database.
Is This Answer Correct ? | 5 Yes | 1 No |
Answer / ramu.m
You have to create the DSN programatically by using some
code.
Is This Answer Correct ? | 3 Yes | 0 No |
Answer / vikram
You can used DSN Less Code here (which is more usefull
andimportant insteated of using DSN Coz when you run that
Application on Different PC, then you have to crete DSN
again..)
DSN Less Code for Connection MS ACCESS: or can connect any
db just need to change its provider:
dim con as new adodb.Connection
con.open "provider=microsoft.jet.oledb.4.0;" & "Data
Source= ur db path (there is no space btn Folder and File
Name)"
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / vikas gupta`
you can try this for the perticular user in sql
'Set con = New Connection
'con.ConnectionString = "Provider=SQLOLEDB.1;Integrated
Security=SSPI;Persist Security Info=False;Initial
Catalog=account;Data Source=."
'con.Open
'Set rec = New Recordset
'rec.Open "select * from acc_details", con, adOpenDynamic,
adLockOptimistic
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / abdul khadeer
After creating the DSN. You can use that DSN to access the
DATA.
For Example U Can Use the ADODB connection Object to
connect the Database by using ur DSN created.
For Example Say "Con" is object ADODB.Connection
Then open ur coonection.
Con.Open "MyDSN","UserName","Password"
Now the conection created, Now u can use this connection
object with ur record set oject to retirve the data
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / sri
You also can create the DSN Programatically as follows
Creating DSN Programatically
Private Sub ConfigDSN()
On Error Resume Next
#If Win32 Then
Dim intRet As Long
#Else
Dim intRet As Integer
#End If
Dim strDriver As String
Dim strAttributes As String
Dim msmdbpath As String
' sdPathName = App.path & "\PROJECT.mdb"
strDriver = "Microsoft Access Driver (*.mdb)"
strAttributes = "SERVER=" & Chr$(0)
strAttributes = strAttributes & "DESCRIPTION=OJAL Data
Souce Name" & Chr$(0)
strAttributes = strAttributes & "DSN=INT" & Chr$(0)
strAttributes = strAttributes & "DATABASE=" &
sdPathName & Chr$(0)
strAttributes = strAttributes & "MaxBufferSize=512" &
Chr$(0)
strAttributes = strAttributes & "PageTimeOut=5" & Chr$(0)
strAttributes = strAttributes & "DBQ=" & sdPathName &
Chr$(0)
intRet = SQLConfigDataSource(vbAPINull,
ODBC_CONFIG_DSN, strDriver, strAttributes)
End Sub
Is This Answer Correct ? | 0 Yes | 0 No |
How would you access objects created in ActiveX Exe and ActiveX D1T ?
What is the need of tabindex property is label control.
what is single thread and multithread apartments model?
What is the use of parameters collection?
WHAT IS DIFFERENCE BETWEEN Message box and image box
Difference between Linked Object and Embedded Object?
What is the use of Scalewidth and ScaleHeight Proeperty?
What is the default property of data control?
How do I force a file dialogue box to reread the currect disk?
What is the use of Visual Basic Document file?
Using which type we can access file line by line?
what is the property to resize a label control according to your caption?