How to solve Connection Error VB.net & SQL? - sql

I have an application which runs perfectly, but sometimes I get the following error. I have attached the screen shot below. Can anyone help?

This error happens, when your application cannot connect to a server due to, for example incorrect connection string, which is not the case, since you said it works most of the time. To make sure everything is OK, validate your onnection string.
Second thing that comes to my mind is that, it your application just cannot connect with remote server, that database is running on. Try pinging your IP or DNS name in command line using ping and see what the result is.

Related

Problem after trying to connect with database

The German text says the data source name was not found and no default driver was specified.
Being fairly new to programming in R, I have absolutely no idea how to fix the problem.
The database query is supposed to fill an Excel, which is output empty due to the error.
The error does not occur with my colleagues, but no one can explain why it is the case with me.
error
The connectDB function looks like something created inhouse. Try stepping through it to see if you can get more details on the error. It is possible that you PC has not been setup for the ODBC connection, or some other environment variable is missing on your machine.

Access VBA: Shell command broken in one particular database

I have two Access databases that I'm opening on the same computer. In one, running this in the immediate window works as expected (opens Notepad):
Shell "notepad.exe"
In the other, I get this error instead:
Run-time error '5': Invalid procedure call or argument
I have not been able to come up with any shell command that will run successfully in that second database. No matter what, I get that error.
What is going on here? Could there be a security setting coming into play? Or perhaps one is an older version?
Edit - More Info
When I go to the definition of Shell in the malfunctioning database, it goes to VBA.Interaction.Shell.
I get the correct IntelliSense tooltip for Shell.
I tried VBA.Shell "notepad.exe" and VBA.Interaction.Shell "notepad.exe" without success (same error).
Here are the references that are checked in both databases:
Decompiling did not help.
The culprit was our anti-virus software! UGH!
Why did it work in one database and not the other then? I'm told that years ago, anti-virus exceptions were made for my computer for the one database but not the other.
I recommend that any others who encounter this problem check their anti-virus logs/policies. Also, running the database from another computer with different policies in place might shed some light on the issue faster. In this case, when I used remote desktop to log into a server, I was able to call shell successfully.

Sqldependency:Query Notifications not receiving properly

We are using SQldependency for Query Notifications in our program. In our webserver we have database from which we send query notification. The application runs in our office PC. It works fine and I do receive instant notification on any changes in table. But for last few days sometimes I get error. The application is does not get any notification even though changes are there. The problem comes at random time. I also confirmed the internet connection by using continuous ping to the server and it was proper. Reopening my application solved the problem temporarily. But I want to know what may be reason for this problem. How can I troubleshoot it.
I don't think anyone can guess what is wrong with your deployment, w/o any info. My advice is to read The Mysterious Notification, Troubleshooting Query Notifications and Troubleshooting Dialogs. With a better understand of how it works and what to look for, perhaps you can diagnose the issue.

error when adding tableadapter to dataset

I am developing a winforms application in Vb.net
when i try to add a tableadapter to an existing dataset I am receiving the error:
Failed to open a connection to the database.
"An attempt to attach an auto-named database for file ###Filelocation### failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share." Check the connection and try again.
This same dataset has 2 other tableadapters using the same dataconnection (as I am selecting the already existing dataconnection) which work fine
this connection is using application connection strings:
Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\test.mdf;Integrated
server=localhost;user id=root;password=password;database=testuser;persistsecurityinfo=True
this error pops up every time I select the dataconnector on the first window that pops up.
Why is this happening
additional info:
The other 2 tableadapters were added to this dataset using a different computer
this is for a mysql connection
I found this post on the MSDN forum:
An attempt to attach an auto-named database ....\aspnetdb.mdf failed
One of the suggestions is as Mr. DonBoitnott correctly says, add User Instance=True;. But, there's also another suggestion posted by Luke A.
"For the record, not one single error message given to me during the course of trying to fix this was relevant to the actual problem. Upon first receiving "An attempt to attached an auto-named database..." I looked online for every suggestion I could find: use an absolute path to the MDF, reorder TCP/IP and named pipes in the server configuration, disable/enable UserInstance (depending on where you looked), change security settings, reconfigure authentication, give specific login credentials.
None of these worked. All of these led to different vague/ambiguous error messages, which led to another problem which required a solution which led back to the original error message... an endless loop of problems, completely unrelated to what was actually wrong.
_Also, posts about setting correct permissions on the App_Data folder are deceptive, as they imply the default permissions were not sufficient for SQL Express (in fact, they are). The whole point of this VS environment is that you can develop a web application and plop it right onto an IIS/SQLExpress setup and have it work. This makes the applications more portable (within IIS, of course) and secure. Of course, everything configuration-related has been obfuscated enough to make it several orders of magnitude more difficult than it has to be."_
So: Try prepend Initial Catalog=uniquenamehere to your connection string.
Though he says "... where 'uniquenamehere' is some name for your project.", try replacing uniquenamehere with the actual name of the database where the table exists.
the file is a .mdf file so it is a mssql file
my guess would be that as you stated you are using mysql the connection string has to be a tad different and therefore the Dataset can't connect to Mysql
Try adding User Instance=True; to the connection string.

Connect to one server, and from there connect to another to read file

My problem is I basically need to on command, connect to one server, and from there connect to another (both of which I have access to). I need to connect to the first to reach the second. And on the second I need to read something from a text file. And fire that information back.
Is that possible? I wouldn't even know where to start. I'm fine with the text file thing!
Help would be appreciated.
EDIT - neither server is connected to the inter-web : (.
You will have to do something like a Service or Web Service on both of them so you can communicate with them and allow them to do some work.