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 do you clear the current selected item from a drop down combo box?
which property is used to lock a textbox to enter data?
what are the Differences between Class Module and Standard Module?
What do you mean by Databound Controls? Explain.
Does VB support object-oriented concepts? Explain..
What is datagrid in vb net?
What is the need of tabindex property is label control?
___ argument can be used to make a menuitem into bold.
What is the difference between Exec and ExecSQL? (wouldnt this be dependent on data access? Ie ADO use different method than DAO)
Specify technical & functional architecture of your last 2 projects.
Which controls can not be placed in MDI?
What does option Explicit means?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)