Module dataAccess
Public TotalCost
Public m_strToppings As String
Public m_strPizzaType As String
' Description: link a VB interface with a 2003 Access Database
' This is my connection String
Public constring()
Dim ConnString As String = "Provider=Microsoft.jet.OLEDB.4.0;Data Source" = CStr(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) & "PizzaProject\PizzaDB.mdb")
Dim DBCon As New OleDb.OleDbConnection(ConnString)
Sub OpenDatabaseConnction() 'to open connection
If DBCon.State = ConnectionState.Closed Then
DBCon.Open()
MessageBox.Show("Open")
End If
End Sub
Sub CloseDatabaseConnction() 'to close connection
If DBCon.State = ConnectionState.Open Then
DBCon.Close()
End If
End Sub
Function ShowALLCustomerAccountDetails() As DataSet ' To send the info to a datagrid
OpenDatabaseConnction()
Dim rs As New ADODB.Recordset()
rs.CursorLocation = ADODB.CursorLocationEnum.adUseClient
rs.CursorType = ADODB.CursorTypeEnum.adOpenStatic
rs.LockType = ADODB.LockTypeEnum.adLockBatchOptimistic
rs.Open("select * from CustomerAccountDetails", ConnString)
rs.ActiveConnection = Nothing
CloseDatabaseConnction()
Dim da As New System.Data.OleDb.OleDbDataAdapter()
Dim ds As New DataSet()
da.Fill(ds, rs, "CustomerAccountDetails")
Return ds
End Function
Public Class frmEditCustomerDetails
Private Sub btnShowDetails_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShowDetails.Click
Dim ds As DataSet ' Show details in datagrid
ds = dataAccess.ShowALLCustomerAccountDetails()
With DataGridView1
.DataSource = ds.Tables("CustomerAccountDetails")
End With
End Sub
End Class
can anyone tell me why the connection string for the jscript doesn't work but vbscript does? I'm using IE7 only.
------------------------------------ Code Start -----------------------------
<html>
<head>
<title></title>
<script language="vbscript">
Sub GetVBscriptData()
Set oADOCon = CreateObject("ADODB.Connection")
Set oRecSet = Createobject("ADODB.recordset")
oADOCon.ConnectionString = "Provider=SQLOLEDB;Server=PIBDKM894\SQLEXPRESS;Database=SOEAudit;Uid=SOEAuditAdmin;Pwd=password"
oADOCon.Open
oRecSet.Open "SELECT * FROM Customers", oADOCon
sList = ""
Do Until oRecSet.EOF
sList = sList & oRecSet("NewFirstName") & vbCrLf
oRecSet.MoveNext
Loop
MsgBox sList
End Sub
</script>
<script language="javascript">
function GetJScriptData() {
var oADOCon = new ActiveXObject("ADODB.Connection");
var oRecSet = new ActiveXObject("ADODB.Recordset");
var ConnectionString = "Provider=SQLOLEDB;Server=PIBDKM894\SQLEXPRESS;Database=SOEAudit;Uid=SOEAuditAdmin;Pwd=password";
oADOCon.Open(ConnectionString);
oRecSet.Open("SELECT * FROM Customers",oADOCon);
var sList = "";
while (!oRecSet.EOF){
sList = sList + oRecSet("NewFirstName");
oRecSet.MoveNext();
}
alert(sList);
}
</script>
</head>
<body>
<input type="button" onclick="GetVBscriptData()" value=" Get some data via vbscript">
<input type="button" onclick="GetJScriptData()" value=" Get some data via javascript">
</body>
</html>
------------------------------------- Code End ------------------------------
The error I receive is:
Message: [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.
Line: 26 (opening the javascript connection)
I can only presume it's the syntax of the connection string. Any ideas how to alter the string to get it connecting?
I am writing c# application to connect to a DB2 database using OLE DB,
do any one of u knows the correct format of the connection string, if possible, pls give an example.
Much
I am using Win 2k and using VC .net (DB2 CLI library) to connect to database. I am currently connecting to server through DSN and it is working fine, but I don't want to make DSN to connect. Instead, I want to use connection string to connect to the database. I gave the following connection string: -
"driver={IBM DB2 ODBC DRIVER};Database=sample;hostname=192.168.4.8;port= 50000;protocol=TCPIP;uid=db2admin;pwd=click123"
I am connecting to database named "sample" on server whose IP is 192.168.4.8. Username/Password are db2admin/click123. It is giving the following error message: -
"[IBM][CLI Driver] SQL30082N Attempt to establish connection failed with security reason "24" ("USERNAME AND/OR PASSWORD INVALID"). SQLSTATE=08001"
I think 50000 is the default port on which it listens. I have tried changing the port number, but then it gives errors like "Communication could not be established". The username/password works fine when I use it to make DSN in control panel and when I use it on server.
Can anyone tell me why is it giving such message? I'll be really grateful.
I am having difficulty finding a connection string which will use a DB User Group name rather than the individual user. The client does not want to add DB2 users by individual... and I need to alter the program to accomodate them.
The current string, referencing the individual user works fine when referencing the individual user. If I use the DB2 Group Name then a user id/password error results:
Provider=IBMDADB2;Database=sample;HOSTNAME=db2host ;PROTOCOL=TCPIP;PORT=50000;uid=myUserName;pwd=myPw d;
i'm using visual basic with mysql and i have a character problem. When i use to get tables with code objects, there is no problem. Because at first i use to execute
"Set Names 'latin5';" on my connection. Than i get my table names in orijinal characters.
The problem in visual objects that i can't do any code opetarion on it. Example Microsoft Adodc control. i configure it connection string, then i want to select record source as a table. But the table names in list have bad characters. Because there in no option to select latin5 to use.
is there any options in connection string that allow me to select latin5.
do i have to select character set after connection has completed.
help me.
Hi, I am brand new to MySQL. I have the task of developing a website that is being hosted on Unix and my usual MS Access databases cannot be used on it.
The Webhosting company already provides access to MySQL as part of the service being offered.
I develop websites using Macromedia Dreamweaver MX.
My question is as follows:
How do you create a connection string for MySQL in a website that is being hosted on UNIX in order to have access to the MySQL database residing on that system??
Usually, I would create an ODBC connection, but I do not see how this is possible on the UNIX system...any help on this issue would be greatly appreciated!
Thanx!
John Vega
I've seen a few people who are unfamiliar with MS ODBC technology, and just wanted to throw this out there for them to use.
One of the hardest things for me to learn at first was how to build a connection string to a database. There's quite a bit of info that can be put in a connection string, and the easiest way to get there is like this.
right click (in the folder where your DB resides), then click "add new">>"text file". Name it what you want, but instead of using .txt for it's file type, make it a .udl (don't ask what it stands for). Windows will ask if you are sure you want to change the file extension. Click yes.
Double click on the UDL file and a dialogue box titled "Data Link Properties" will pop up. It defaults to the connection tab, but you need to first go to the "provider" tab.
Select the proper provider (MS JET 3.51, MS HET 4.0, or MS OLE DB PROVIDER for SQL Server), then click "next".
If you're using access, just browse to the database. Put in your account name and password, then click "Test Connection". If the connection succeeds, then click "OK" on the bottom.
If you're using SQL Server, under the "Connection" tab, use the drop-down to select the correct server. Enter the correct security information, then select the proper database. Finally, test the connection. If it succeeds, then just click OK.
Now, right click on the .udl file, and select "Open with". Use notepad to open it. When notepad opens the file, you will see 3 lines. The third line is the whole connection string. Copy and paste it as the argument for the connection.open method.
Works every time
I'm working on a program that interacts with the MySQL database of a website.
I have a class for the Database in C# which manages the connection and closing etc. It also stores a constant for the connection string similar to the following example:
private const string CONN_STRING = "SERVER=someServer;" +
"DATABASE=someDatabase;" +
"UID=someUser;" +
"PASSWORD=somePassword;";
// connect
private MySqlConnection connection = new MySqlConnection(CONN_STRING);
A recent concern I've had is whether someone could reverse engineer the program, get the access details and then perhaps get access to the database and do some severe damage.
If this is a possible hole, is there anyway to protect these details?
I am new to .NET and currently need some help in developing a web service. The connection string inside the web service is fixed but leave the database server name blank. When the client call the web methods from the web service, I need to pass the database server name into the web service. I had tried to use constructor (sub new) and class property inside the web service class but failed. And I cannot store the connection string inside the web.config file. Is there any way to pass in a global yet dynamic value/property into the XML web service?
The following is the example fo my connection string:
Public Function sGetConnectionString() As String
sGetConnectionString = "User ID=sa;Data Source=" & msServerName & ";Tag with column collation when possible=False;Initial Catalog=test;Use Procedure for Prepare=1;Auto Translate=True;Persist Security Info=False;Provider=""SQLOLEDB.1"";Workstation ID=PAMMY"
End Function
Your help is highly appreciated
I have difficulty in connecting MYSQL and VB.
Would you please help me, give me the connection string for that.?
I have the following connection string that can't open my database. Does anybody here know what's wrong with this string?
char strConnAccess[] = "Driver = {Microsoft Access Driver (*.mdb)};DBQ = C:\\DC2004.mdb;";//
I know my program works because I can open it with
char strConnJet[] = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\\DC2004.mdb; User Id=admin; Password="; //Works
I'm using the string examples from:
http://www.sqlstrings.com/MS-Access-connection-strings.htm
All,
I'm having a tough time figuring out the proper connection string to connect to my existing database.
Using:
* MySQL server 4.0 on a remote Linux Server.
* Developing in VS 2005 (VB) on a PC that is apart of our corporate MS domain.
* Downloaded and installed Connector/Net 2.0
Problem:
I'm using the connection string: ("server={0}; user id={1}; password={2}; database=test; pooling=false", server.Text, userid.Text, password.Text)
When executed with userid="sam" the error message that is returned is "Access denied for user: "sam@<mypc>.<corporatedomain>.com"
When executed with the userid="sam@<remotehost> the error message returned is "Access denied for user "sam@<remotehost>@<mypc>.<corporatedomain>.com". No matter what I do, the connector keeps appending my current domain id to the end of the user string.
"sam" is a authorized user for the MySQL on the remote linux host (been using it for years).
Is there a different way to do this?
I'm new to mySQL (especially the set up part). I've exported my DB as a .sql file:
1) Where on my site is the best place to put the .sql file? Does it have to be anywhere specific?
2) Where can I find the right connection string that I need?
Thanks,
- MT
-=<->=-=<->=-=<->=-=<->=-
Matt Torbin
Web and Graphic Arts Engineer
PEI-Genesis
2180 Hornig Road
Philadelphia, Pa 19116
Edited 1 time(s). Last edit at 03/14/2006 11:21AM by Matt Torbin.
Hi, i've modified a connection string to select the correct socket:
$connection = mysql_connect(':/var/run/mysqld/mysqld.sock', $url['user'], $ur......................................etc
mysql_select_db('astbill' , ':/var/run/mysqld/mysqld.sock') or die('unable to$
return $connection;
}
butI receive the error:
Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/astbill/wwwroot/includes/database.mysql.inc on line 32
unable to select database
can you point me in the right direction?
I have Biztalk server 2009 and it has DB2 Adapter to connect DB2 server. I have 2 DB2 environments :
1. DB2/iSeries (AS400)
2. DB2/NT (developer version on windows 2003 server)
When I cofigure Biztalk Server DB2 Adapter, it ask me to enter below connection string parameters and I don't know how to get there parameter: (below including parameter explaination for DB2/as400)
a. "Initial catalog", type the name of the AS/400 RDBNAME. Typically, this is the name of the IBM iSeries (AS/400) system.
b. "Package collection", type the name of the AS/400 library in which the packages for the provider are created and stored.
c. "Default schema", type the default schema name. Typically, this is the name of the AS/400 library in which the tables are accessed.
d. "Default qualifier", type the name of the default qualifier.
---If the library that hosts the tables differs from the library that is specified in the default schema, the Default qualifier box should contain the name of the library that hosts the table. This value is used as the second value in a three-part naming scheme.
---If the library that hosts the table is the same as the default schema, leave this box blank.
I guess this miscrosoft OLE DB connection need above parameters.
I have below parameters
1. server name
2. database name
3. instance name
4. username
5. password
6. port number
how to fill connection string parameter using my parameter ?
How to get default schemas, .....
Anyone used SQL server with PHP? I need to know the COnnection string and the basic commands... But the connection string mainly
We are trying to test connection string but it alwasy hangs there forever. We have asp test page and .net vb to test but both are the same thing. I wonder anyone experience this before can give us some help. We are using Unidata 6.0. The asp page that I use is on UniOleDB menu. Sometimes works, most of time don't work and it just hangs there.
Thanks
cody wang
Programmer
Ohio Dominican Univeristy
614-251-4799
I am running SQL Server 7 and SQL Server 2000 on the same box. The following two connection strings both work when I run asp applications from the network.
Application("Sales") = "driver=sql server;server=SQL01;database=Sales;uid=SalesUser;p assword=xxxx"
Application("Survey") = "driver=sql server;server=SQL01\SQL2000;database=Surveys;uid=S urveyUser;password=xxxx"
On external IIS servers I use the following connection string replacing the IP address for the server name. It works fine.
Application("Sales") = "driver=sql server;server=55.55.55.55;database=Sales;uid=Sales User;password=xxxx"
But this does not work.
Application("ARESales") = "driver=sql server;server=55.55.55.55\SQL2000;database=Sales;u id=SurveyUser;password=xxxx"
I cannot connect via Enterprise manager either for the SQL2000 instance when trying to use IP/Instance
I'd like to establish a WinNT4 -> DB2/MVS connection via the IBM OLE DB
Provider for DB2 Servers of the DB2 connect version 7 software bundle.
I already was able to access data using a predefined data source created
with the "Client Configuration Utility". The connection string looked like
"Provider=IBMDADB2.1;Password=pwd;User ID=usr;Data Source=ds".
Is it possible to establish a connection without defining any data sources,
just by using the connection string?
What are the keywords or where can I find a detailed documentation?
Two questions:
1. What is the provider name used in Stinger? Native IBM provider?
2. Has anyone got a working connection string example for use with the
IBMDA400 provider? I have never been able to get this provider to work.
Running iSeries, V5R2.