I have a database connection string to a password-encrypted MS Access database and I need help in completing the connection string - ms-access

[Connection String I need help with]
I am a newbie and I just learned this online. I was able to complete a project with a working connection to an MS Access database that is not encrypted. Now, I have to put password on the database as requested by the users and because of that, my connection is no longer working. So I also updated the connection string (The one in the picture). I am trying to complete this string but I do not know how to put that "Options as Long = -1". Just to add to the context, If I do not complete that string, "I am getting error 13 Type mismatch on import data", so I kinda figured out that that string should be completed and that option should be defined as long in order to get through the type mismatch. If there is also another way to this, I would be glad to learn. Appreciate any help. Thanks.
I tried just putting option: long, or options: long =-1, nothings working.

Your code is not correct.
You can try the following code to open the connection
cnn.ConnectionString = "Provider=Microsoft.Ace.OLEDB.12.0;Data Source=" & dbPath & ";Mode=Share Deny None;Jet OLEDB:Database Password=testpassword"
cnn.Open

Related

Cannot connect to MySQL server database in program [VB]

Firstly, as far as I know sharing the username/password should NOT be done as I'm attempting to make a user register/login program. My server is remote, so I connect to it with an IP address. I have been trying for a very long time but I always run into errors.
Even when providing the MySQL Username and password, it fails entirely.
Some stuff I've tried:
Dim connection As New MySqlConnection("datasource=(ip);port=22;username=root;password=(pwd);database=(db)")
Dim connection As New MySqlConnection("datasource=(ip);port=3306;username=root;password=(pwd);database=(db)")
Dim connection As New MySqlConnection("server=(ip);port=22;username=root;password=(pwd);database=(db)")
And then I realised another thing about my server, I require the SSH option when connecting so I tried this. However I still encounter the same errors on opening the MySQLConnection (portFwld.Start & Client.Connect is successful)
Dim ConnectionInfo = New PasswordConnectionInfo("(IP)", "root", "(PWD)")
Dim ConString = New MySqlConnectionStringBuilder
ConnectionInfo.Timeout = TimeSpan.FromSeconds(7)
Dim client = New SshClient(ConnectionInfo)
client.Connect()
Dim portFwld = New ForwardedPortLocal("127.0.0.1", Convert.ToUInt32("3306"), "(IP)", Convert.ToUInt32("22"))
client.AddForwardedPort(portFwld)
portFwld.Start()
ConString.Server = "(IP)"
ConString.Port = "22"
ConString.UserID = "root"
ConString.Password = "(PWD)"
ConString.Database = "(DB)"
Dim Connection = New MySqlConnection(ConString.ToString)
Connection.Open()
The errors I encountered were mostly these:
{"Reading from the stream has failed."}
and:
{"Unable to connect to any of the specified MySQL hosts."}
I literally have no idea why nothing is working whatsoever. I've searched and searched and I cannot find the solution. Also a reminder; I'm pretty sure I don't want the password revealed so blatantly in a string, let alone revealed at all.
Please be considerate as I'm completely new to this and just want to setup a community program just like any other program/site (like accounts here on Stackoverflow).
Thanks in advance.
The issue was that I needed to go to my server's cPanel and go to the allowed IPs area and add %, after that connection was all successful.

Connecting an Access form to a SQL Server

I have been working on a project that is near completion but this final part is causing me some headaches because I have never done this before and I am having a hard time finding the research to help get me going I have no idea where to even begin. The project is as follows: (this is the context of the email from my boss)
You will need to look up how to check for connectivity using vba. The server you will connect to is the HRLearnDev. I have an access form I will send you that has the connection info in macros on it, where I did something similar. The difference is, my program connected directly to the server. Yours will need to write to a local table, do a check for connectivity when the access file is opened, or every few minutes or something, and if the check reads that there is a connection, write the data from the local server table to the remote server table, then truncate the local table.
I am really stuck and I am running out of options so any insight on where to start to look that is for beginners would be greatly appreciated.
Try something like this to check the connection:
Public Sub TestConnection()
Dim cnn As ADODB.Connection
Dim canConnect As Boolean
Set cnn = New ADODB.Connection
cnn.Provider = "sqloledb"
cnn.Open "Data Source=HRLearnDev;Initial Catalog=YourTableName;UserID=userID;Password='password';"
If cnn.State = adStateOpen Then
canConnect = True
cnn.Close
End If
MsgBox "Can you connect? - " & canConnect
End Sub
Honestly, this is obviously a homework problem and I don't think giving you the entire answer would be the right thing to do, but that should get you started.

Trouble Adding Web Service to VS2010 for SSRS CLR Stored Proc

I am attempting to reference the SSRS web service and it is not going as expected, please let me know what I'm doing wrong.
In VS 2010:
Step 1) Add Service Reference
Address=http://myserver/reportserver/reportservice2005.asmx?wsdl (server does not have a named instance)
name = ReportingServices2005_BETA
Step 2) Then in my clr_sproc I write:
_
Public Shared Sub TestMonkey2(RptName As SqlString,
Params As SqlString,
FileName As SqlString)
Dim rs As New ReportingServices2005_BETA()
Result:
I get an error in the error list "Error 1 Type expected"
I can write these lines without error...
Dim rs As New ReportingServices2005_BETA.Job
Dim rs As New ReportingServices2005_BETA.Role
Dim rs As New ReportingServices2005_BETA.Task
but those to not match all of the tutorials on the web?
I know I'm missing something simple...
thanks
Found my problem, I was adding a Service Reference instead of a Web Reference, problem solved.
But in the long run, I found you cannot use ReportingServices2005 in a CLR due to security restrictions. I'm back to the drawing board.
dang.

How do I establish a connection to MySQL via VB & display simple query results on a form?

I have a project in Visual Studio 2008 and there is a working data connection to a MySQL database. In other words, I can query the db directly from Visual Studio and it will display the results.
I've tried a couple of approaches that I found online for writing a connection string and accessing the db, but no luck yet.
All I'm trying to do is code a button to query the db and then reset the text property of a label/textbox to display the results based upon another label/textbox value.
The pseudo-code I am imagining is something like this:
Private Sub query_submit_button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles query_submit_button.Click
result_textbox.Text = SELECT field FROM table WHERE otherfield = key_textbox.Text
End Sub
I didn't see any related questions posted on SO - forgive me if I missed one that already exists and this is a dupe.
What is the correct way to accomplish this?
EDIT
Using MySQL 5.1
You can download the ODBC Provider and then reference, import, and use it to query the database through a ODBCCommand instance.
'Put this at the very top of your .VB file...
Imports System.Data.ODBC
'Put this in some method in your code when you are ready to query the DB...
Using connection As New OdbcConnection(connectionString)
Dim command As New OdbcCommand(strSqlQuery, connection)
connection.Open()
result_textbox.Text = command.ExecuteScalar.ToString
End Using
i used DaMartyr's answer to get 99% there, but needed to add this declaration:
Dim connectionString As String = "driver={MySQL ODBC 5.1 Driver};server=SERVER;uid=USERID;pwd=PASSWORD;database=DATABASE"
just replace the SERVER, USERID, PASSWORD, & DATABASE with your personal settings

ADODB Connection String: Workgroup Information file is Missing?

I have a few data sources in access that I need to connect to programatically to do things with behind the scenes and keep visibility away from users.
Said datasource has a password 'pass' as I'm going to call it here. Using this connection method I get an error attempting to use the open method
Dim conn as ADODB.Connection
Set ROBBERS.conn = New ADODB.Connection
conn.open "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=\\pep-home\projects\billing\autobilling\DPBilling2.mdb;" _
& "Jet OLEDB:Database Password=pass;", "admin", "pass"
"Cannot start your application. The workgroup information file is missing or opened exclusively by another user."
Due to planning to move into 2007, we are not using nor have ever used a workgroup identification file through access. The database password on the data source was set through the Set Databa Password which had to be done on an exclusive open.
Ive spent a good while changing around my connection options, where to put the passwords etc and either cannot find the right format, or (why I'm asking here) I think there may be some other unknown that I must setup to do this. Anyone out there got some useful information?
Your connection string seems to be incorrect. Try:
conn.open "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=\\pep-home\projects\billing\autobilling\DPBilling2.mdb;" _
& "Jet OLEDB:Database Password=MyDbPassword;"
-- http://www.connectionstrings.com/access