Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Data1 - Connect Via ODBC


Dear all at the moment I'm connecting to a db using the code below and the data component, normally
called data1.

I have been trying to conect to another db but this time using OBDC, but this time without success, also
I'm using DAO 3.6.

=============== Current Code ==================
Data1.DatabaseName = "c:windowsdesktopmydb.mdb"
Data1.Connect = Access
Data1.RecordSource = Me.txtSQL.Text
' We make the results visible
DBGrid1.Visible = True
Data1.Refresh




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Connect Data1.Connect Question
Hi All.


I use this scode to Connect to my database through a DATA Object.



With Data1
Data1.connect = "Access 2000;"
Data1.connect = ";Pwd=" & "dark"
Data1.DatabaseName = (App.Path & "dbase.mdb")
Data1.RecordSource = "customerinfo"
Data1.Refresh
End With



HOW I can change this code so I can connect to an SQL Server?

I trnansfeered the data to my SQL Server, is there any way to connet to it using the DATA Object, I DONT want to use the ADO.



Any help would be appreciated.

MIcrosIM

What To Do, That Data1.Connect Property Could Be Set To Access 2000 ?
Hallo My Dears !
What to do, that Data1.Connect property could be set to Access 2000 ?
On my PC Win 98, VB6.0, Access 2000 are installed.
When working , at VB6.0 design time Data1.DataBaseName propety is set to MSAccess 2000 data base name. Data1.Connect property list consists of: Access, dBase III;, dBase IV; , .....
While Data1.Connect property Must be Access 2000, Access, dBase III;, dBase IV; , ..

How to include Access 2000 to this list ??

Remark:
On another PC where Win 2000, the same VB6.0, Access 2000 are installed.
Data1.Connect property list consists of: Access 2000, Access, dBase III;, dBase IV; , .....
It's Right.



What to do, that Data1.Connect property could be set to Access 2000 on My PC with Win98 ?

Resolved ! Thanks

Connect DB By ODBC
Because I want connect SQL/Oracle Database.
Can you give me a template function using ODBC.

Connect Without ODBC???
Does anyone know of a way to connect to SYBASE or MS-SQL Server through VB without using ODBC?

Thanx

Odbc - ADO To Connect To As/400
Could someone help me (code) to connect to an as/400 database using ado and an odbc driver.

Connect With Odbc
hai all,

firstly , sorry about my english is not good ?

I'm still confuse about connected between sql server 2000 and visual basic with odbc?
can you explain more detail about it.
example:
insert,update,delete,search and show it in datagrid, record in visual basic code ?

Connect From VB To MySQL Without ODBC
Hello! i am writting a game server and my plan is to make it to put the number of players online in a mysql database for showing it on a website after and probably on the client.. but i need a way to connect on mysql without the need to install ODBC drivers..

Thanks!

How To Connect To Oracle With ADO Without ODBC
I want now how to connect to Oracle in VB6 and VB.NET without ODBC.

How To Connect Oracle Using Odbc
Hai all.

I request your valuable help.

I have VB 6.0 and Oracle 8 personnel edition in my system. I would like access oracle database using ODBC. I tried by creating a user DSN through Windows Cotrol Panel. Then while accessing through VB it asks SQL Server login. SQL server is not there. There it terminates. Can someone tell me the exact procedure starting from the very begining, for connecting the Oracle database through ODBC and how to access the data.

Thanking You.

How To Connect Odbc Via Code?
i want to connect to odbc (access 2000) in run time. how can i do that?
tnx
uv

Best Way To Connect To Remote DB, ADO Or ODBC?
Hi all !

I need some solid advice on the best way to connect to a remote MS ACCESS 2000 DB. I have 4 a software running on different PCs and they all connect to one central DB which is located on another PC which is on the same LAN. Currently I have used ADO connection method to connect this DB in the program. Is it the best way? Is it faster than ODBC? Can you please tell what the professional would normally do. The path to this central DB is in an INI file on each PC. I know ADO support remote connection, but I'm using the following code to connect and open tables. Is this fine.

In the INI file, the DB path is defined as follows
Databasename=\192.9.205.44CTEST.MDB

[Connecting Code]
Mystr="SELECT * FROM TABLENAME;"
MyCnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & DatabaseName & ";Jet OLEDB;Database Password=" & DBPwd
MyRst.Open MyStr, MyCnn, adOpenStatic, adLockReadOnly, adCmdTableDirect

Please help ! THANK YOU !

How To Connect To SQL Server Using ODBC?
I am Anup. I am very new with SQL Server.
I have SQL Server 2000.My Opeating System is Windows XP.
I cannot install the server in my PC.I can install only the Client components of SQL in my system.
I downloaded MSDE 2000A. How can I use this in my system with the SQL client components?
After installing this , Can I use database normally in SQL Server?
What is the procedure?

2. Please describe the step by step instructions to create DSN and my database is MyDatabase. It is not the default database.

3. Please give me the code to connect from VB to SQL Server using this ODBC.

Thanx in advance. Its very urgent.

Connect To Oracle Without Using ODBC
Hi All,

Can it is possible to connect to Oracle in VB without using ODBC ?

How?

Connect To An Oracle Database Without Using ODBC?
Is there a way to connect to an Oracle database without using ODBC?

Thanks...

Using The ODBC Connect String Securely
Hi

I have an access db (97) with a vba front end. The code runs about 15 pass-through queries that require the user to log in to the server for each one. They will be run automatically over night so the user wont be able to log in 15 times. I know that I can use the ODBC connect string something like this:
"ODBC;DSN=DB2MVSP;DB=DB2MVSP;UID=" & username & ";PWD=" & pass

which is fine, and it works, but this seems rather risky in terms of revealing the password. someone could just come along, press break, and debug the code and find out the password whilst it is running. I know I could lock the screen but i would just like something a little neater.

any ideas?
thanks

How To Connect VB6.0 (Access Database) Using ODBC
Hello All,

I have to connect to an Access database , db1.mdb from my Visual Basic Code.I created a DSN for .mdb called "fms".When try to connect to this dsn from my code I am getting error.

Can anyone help me to sort out this.

Dhanya

VB/Access App Cant Connect To Odbc Dbase

I have a VB 6.0 app using access 2000 database. This app resynchs their laptops to the master database on a machine in their office.. They use when they leave the office to copy the dbase locally to the laptop and then point the odbc connection for the app to the copied database... c:... instead of s:..

They then use another vb app which writes to the dbase locally...

Upon return to the office they then resynch the master dbase on the machine in their office... Update with changes made while in the field....

All worked fine until VISTA... I had to install Office 2007 with access on two newly purchased laptops.( Another story)

I had everything running fine until Last week. I now get an error trying to run the "Go remote" utility

Microsoft[ODBC Microsoft Access Driver] 'Unknown' is not a valid path. Make sure the path name is spelled correctly and that you are connected to the server....
-2147467259(80004005)..

 I have googled and read alot and tried a lot of things.. rebooting all machines hasnt worked. Permissions havent changed since it was working ok.. If I try and debugg it in VStudio 2000 It works fine???? Any ideas??

Connect To A Text File Using ODBC
What are the basic steps for connecting to a comma (or anything else) delimited text (ASCII) file using ODBC?

Thank you in advance.

ao

Connect To ODBC Source And Retrieve Data
Quote:





Originally Posted by XL-Dennis


Below You find a solution that do not link the table:


Code:
Option Explicit

Sub Dataimport_SQLServer()
Dim db As DAO.Database
Dim ws As DAO.Workspace
Dim stSQL As String, StConn As String
Dim stDB As String

StConn = "Driver={SQL Server};" & _
"Server=(local);" & _
"Database=pubs;" & _
"Uid=sa;" & _
"Pwd="""

stDB = "c:db1.mdb"

stSQL = "SELECT * INTO [Authors] FROM [" & StConn & "].[authors]"

Set ws = DBEngine.Workspaces(0)
Set db = ws.OpenDatabase(stDB)

db.Execute (stSQL)

db.Close
ws.Close
Set db = Nothing
Set ws = Nothing

End Sub





Hi,
I'm using the above method to link to two tables. One of them I am able to add new records to but the other I can't as it is read only.

Is there something that I need to do to be able to add new records to it?

Both of their unique identifiers are different.

1. main.main_id
2. main_pages.page_id

Could it be that they are linked via the main_id as it is in both tables?

Any idea on what I can do.

The main table is added first via code. Should I make the pages table link first?

Thanks!

Connect To ODBC Source And Retrieve Data
I am using access 97,

I am trying to connect to an sql db and save the connect string in the database for future reference, this all works fine, but the next step is retrieving data from the database and saving it in my current database.

But then i'm stuck, how do i get it to retrieve data? .retrieve should exist, but it doesnt.


Code:
Public Function sptObtainConnectStr(strChallenge As String) As String
Dim dbODBC As Database
Dim ConnectString As String
Dim tmpConnectStr As String
Dim tempPos As Integer
Set dbODBC = OpenDatabase("<db>", False, True, "ODBC;")
ConnectString = dbODBC.Connect

strChallenge = ConnectString
tempPos = InStr(1, ConnectString, ";")

tmpConnectStr = Left(ConnectString, tempPos)
ConnectString = Mid(ConnectString, tempPos + 1)

Do While tempPos <> 0

tempPos = InStr(1, ConnectString, ";")
Select Case Left(ConnectString, InStr(1, ConnectString, "=") - 1)
Case "DSN", "UID", "PWD", "Database"
tmpConnectStr = tmpConnectStr & Left(ConnectString, tempPos)

End Select
ConnectString = Mid(ConnectString, tempPos + 1)


Loop
sptObtainConnectStr = tmpConnectStr & "Database=Pubs"


End Function

Showing ODBC Tables/fields After Connect
I've got a little program that connects to a Mas90 database through ODBC. It connects fine, I'm assuming because I get the logon and password to it, but now I'm trying to display data within the tables/fields in the database.

I've found all kinds of examples of how to connect to ODBC, but I can't find any code examples of HOW to show data from a field in the database.

Can anyone shoot me in the right direction?

Need Help With Connect MSSQL Server 2000 Via ODBC
is this the string to connect to a MSSQL server ?


VB Code:
sConnect = "Driver={SQL Server};Server=localhost;Database=MMORPG;Uid=sa;Pwd=;"


If it is can someone tell me the script to execute a query ?
if it isn't , first is the connection possible and second what's wrong with it?


Thanks

Connect To A Database Through An Odbc Data Source
i'm trying to access the user database defined in th dsn by using ADO, but i dont know how to reference the object models..
can anyone tell me??

Reading A Odbc Connect String From A File
Hello,

instead of hard coding aconnect srting in my code I want to read it from a file.

Has anyone got any examples of how to grab a connect string from a file?

I.E

"Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=XYZ;Data Source=(Local)"

Thank you.

BazzaW

Connect To A Progress Database Using An ODBC Connection Using VB 6
Hi,

I would like to connect to a progress 9.1c database using a ODBC connection using a merant driver via VB6.

Can somebody please assist in my ever growing problem

ACCESS Using ODBC To Connect To The MYSQL Database
Hai all,
I need some help regarding this, 'creating voting system'.i have created login screen and database using SQL.it seems i have to use 'lock' and 'unlock's to get concurrency.Please go through this,ACCESS using ODBC to connect to the MYSQL database.
           A voter must supply a correct user name (login) and password before being allowed to vote. A voter is only allowed to vote once. When a voter votes, his vote should be recorded in such a way that no one can determine the way a voter voted.
             program should be multiple user in that more than one person can vote at a time. Measures need to be taken to make sure the no. of votes counted is correct. To test program, it should be loaded on at least 2 different computers and both tested at the same time.Please help me for code..... Thankyou in advance

Can We Safely Connect To A SQL Server On The Web Through A System ODBC Connection ?
Dear Friends,

I have a package which connects to the database through a system ODBC connection on a local network. Is it safe enough to move the database (SQL Server database) on to the web and continue using the package just like using on the local network ?

Thank You.

Connect To MySql Via Access Error ODBC--call Failed
Hi i found a great tutorial (http://www.washington.edu/computing/web/publishing/mysql-access-3.5.html) on connecting to MySql via Access however i keep getting an ODBC--call failed error [MYSQL][ODBC 3.51]Driver User Cancelled. (#0). I downloaded and installed mysql-connector-odbc-3.51.12-win32.zip and followed the setup instructions. When i tested the connection it was successful, however i don't know the Port ans Socket, as it's a remote server the mySql database is on. Can anyone help me out?

Thanks

Ross

Problem Faced With ODBC Driver Of Sybase While Using To Connect Visual Basic Application To Sybase B
I am having a certain problem with respect to ODBC driver for Sybase 11 .
I am writing an application using VB and Sybase 11.5 that actually reads data from
a text file or wave file from the physical disk and store in a field of
datatype image in sybase 11.5.
When I am using the active X data objects method appendchunk to update that
field to the database the ODBC driver for sybase generates an error that says this method
is not supported by the provider.
Could anyone kindly provide assistance regarding this.It would be very nice if anyone can help me out on this as soon as possible.
Waiting for assistance

[MySQL][ODBC 3.51 Driver]Can't Connect To MySQL Server 10060
How to connect ODBC Driver with MySQL using dynamic IP internet connection in Visual Basic 6.0 application? I am getting error while connecting using [MySQL][ODBC 3.51 Driver] in Vb 6.0 application. I find that using static IP internet connection the application is working successfully but using dynamic IP internet connection occurs
error Description:-"[MySQL][ODBC 3.51 Driver]Can't connect to MySQL server 10060"
and Error No:- "-2147467259". Actually we are using internet connection by "Tata Indicom internet service provider" and this is static IP internet connection and other connection is by "BSNL internet service provider" and this is dynamic IP internet connection.
Please help me as soon as possible.

Data1 Database Name
is there a way, in code, to set the database name field so it goes to the folder that the program exe is in and looks for a specific database name?

Problemes With DATA1
I know this may be a stupid question for most of you, but well, I really need to ask this:

I´d create an form with a Data1.Recordset.AddNew line. My problem is that when there is a field with no text, an error occurs. I just don't know how to fix it (in other words, make it impossible to appear that error msg).

May somebody help me out?

Thanks!
Best regards for all!
Andre!

Adodc1 Or Data1?
i want in my program to search for certain fields inside a database table and if I've entered CORRECTLY one of them it should chack if it is true and continue.

like a login form.please give me some suggestions.
thanks

Data1 Problem
I have a data1 control on my form where i go throguh my records. Now i have validation for my fields now how do i get the data1 to stop at the currect record is a problem?
Right now i have two records if i earse allowed amount gives me a message box but goes to the second record? how can i stop it for moving to the next record?


Heres my validation code


Code:
Private Sub Data1_Validate(Action As Integer, Save As Integer)
If Text46.Text = "" Then
MsgBox ("Please Enter a Process Date")
SSTab1.Tab = 0
Text46.SetFocus
Exit Sub
ElseIf Text61.Text = "" Then
MsgBox ("Please Enter a Allowed Amount")
SSTab1.Tab = 1
Text61.SetFocus

Exit Sub
ElseIf Len(Text61.Text) < 10 Then
MsgBox ("Please Enter Atleast 10 bytes in the Allowed Feild")
SSTab1.Tab = 1
Text61.SetFocus
Exit Sub
end sub

Probleme In Data1
Hi Guy's
I have a probleme in my save code of database
my save code is

----------------------------
Data1.UpdateRecord
Data1.Recordset.Bookmark = Data1.Recordset.LastModified
Msg2.Show
-------------------------
when i click save button
he show me this msg error:
Erroeur D'exécution 524
Elément non trouvés
help me guy's please

Data1.Refresh
I have DBGrid1. I have cmdAddNew (Data1.Recordset.AddNew) and I have cmdRefresh (Data1.Refresh).

I have done this before but it doesn't seem to be working now. It is not adding my entry from Text1 to DBGrid1. Here's the code:

Private Sub cmdAddNew_Click()
Data1.Recordset.AddNew
Text1.SetFocus
End Sub

I enter something in Text1

Private Sub cmdRefresh_Click()
Data1.Refresh
End Sub

Nothing happens here.

Any help?

JO

DAO Data1 - Connection
Dear all at the moment I'm connecting to a db using the code below and the data component, normally
called data1.

I have been trying to conect to another db but this time using OBDC, but this time without success, also
I'm using DAO 3.6.

=============== Current Code ==================
Data1.DatabaseName = "c:windowsdesktopmydb.mdb"
Data1.Connect = Access
Data1.RecordSource = Me.txtSQL.Text
' We make the results visible
DBGrid1.Visible = True
Data1.Refresh

Data1 Vs Adodc
can someone enlighten me on the difference of these two. am using data1 in a project i am making and m being tempted to check if there is an advantage in using Adodc.

=======================================
Ndakafamba, ndakaona, ndakadzidza zvino ndave shasha!!!!

Visual Studio Installer - How Do I Package An ODBC Driver And A ODBC Connection?
Can anyone tell me how I can Package an ODBC Driver and a ODBC connection using Visual Studio Installer.

thank in advance

ODBC Error : [Microsoft][ODBC Driver Manager] Connection Not Open
Hi friends,
I am getting error the following error.
ODBC error : [Microsoft][ODBC driver manager] connection not open.

when I am trying to generate my report in crystal report 8.5. Pls help me out.

Thanks in advance.

ODBC Error: [Microsoft][ODBC Driver Manager]Data Source Name Not Found And No Default
I have a VB App accessing Access Database. I have created an installer using Windows Installer. When the application is installed on a PC with Microsoft Office, everything works fine, However, on PC@s with no Office, the following error message pops up

ODBC error: [Microsoft][ODBC Driver Manager]Data source name not found and no default driver specified

The Operating System is XP wit SP2. MDAC 2.8 is installed.

Any help will be highly appreciated.

Row Header Collected From A Data1
Hy, friends.
I succesfully got a column header of a MSFlexGrid1 collecting titles from a calendar. Now I'm trying to put other information on column (0) which is header of rows. I should have to collect string from:
data1.recordset.fields.("namefield") and the best solution will be a
"for ... next" loop. How to built it ?
Any idea ?

Thanks in advance.
Ric.

Data1 Caption Problem
Im having a problem with my display on my data1 control. When i get to the end of the recordset and click next it displays 0. I have it linked to a access database.

So if my last record is 70 and i click next it displays 0 how can i stop it from showing 0


this is what i use now in my data1
Data1.Caption = "Record: " & (Data1.Recordset.AbsolutePosition + 1)


thanks

Data1 Caption Problem
i have a form linked to my access database. now i use this for the caption of data1

Data1.Caption = "Record: " & (Data1.Recordset.AbsolutePosition + 1)

now when the user clicks the back arrow it somtimes says 0. it should say 1 i dont know why it displays 0? is it going to the empty record that access displays?

Edit by Shurik:
Please don't post your database related questions in General forum

DBCombo Box With Adodc1 And Data1
Hi all,

I just can't seem to get my dbcombo box to work correctly.

If I use a DAO object (data1) and try to map my access 2000 database to it, it comes up with an error when I try to set the property.

If I use an ADO object (adodc1) I can connect to the database with a system DSN via my dbcombo box oblect and select the data source, I have 'data source' fields viewable and can select them, however, when I try to select the 'list field' property, it is empy and therefore I am unable to use the dbcombo box to select an item.

Could someone please offer assistance?

Data1.caption Problem
I am trying to show in the data1 caption a string like 'car 2 of 52', but when a load the program, it shows 'car 1 of 1' and just when I move trough the records that it shows correctly the recordcount.


Code:
Private Sub Data1_Reposition()
Data1.Caption = "Car " & (Data1.Recordset.AbsolutePosition + 1) & " of " & Data1.Recordset.RecordCount
End Sub

any ideas?

Data1.recordset.addnew
how can i have sure that this operation adds the record after the last one of the table, and not somewhere else ?

Error For Data1.msi After Installing
I have created the setup file for my vb application using the wise installation system. After the application gets installed , while clicking on a button to open a form which refers to the ms access database it shows the windows installer screen and asks for installing the missing file data1.msi and if i click cancel on that prompt the application runs as normal. What is the cause of this. How do I resolve this.
Please help asap.

Data1.recordset Problem?
hi...
here is the code sequence.

data1.enabled = False
data1.recordset.AddNew

my question is y we disable the data1 (data control)....but after that we still can call the AddNew function?? confuse???

issit we just diable the user interface generated event...but we still can code it in statement???

vbNovice

Copyright © 2005-08 www.BigResource.com, All rights reserved