If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register or Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Opening an SQL Connection

Hello,

I am very new to SQL and do not understand as much about the language as I had hoped I would after a couple months of looking at it. I am creating a procedure database for work where we store word documents of procedures in a folder and use that to populate our database. I've been getting connection errors because I didn't realize I was trying to use the server.CreateObject command with an Apache DB and then using the connection string with an SQL Server DB. I am using SQL Server 2008 and I just ahd no idea why it wasn't connecting because I had been googling most errors.

A co-worker referred me to this site saying that I would be able to get good advice here. If anybody can reply with some samples SQL Server 2008 connection scripts, that would be great. I want to also mention that I am using VB .NET 4.0 Framework.

I'd like to stress again that I am a beginner in this programming fashion and would like to know. If any part of my questions aren't clear to you, please let me know so I can figure out what you're asking to help me get a better grasp. Thanks!

Re: Opening an SQL Connection

Yes I have. Unfortunately as I said I don't know enough about SQL to understand which connection string I should be using and under which options. One thing I want people from anywhere in the plant I work in to be able connect so it will have to connect via IP probably. Like I said I'm not 100% sure which one to use in this case.

Re: Opening an SQL Connection

Unable to cast COM object of type 'System.__ComObject' to class type 'System.Data.SqlClient.SqlConnection'. Instances of types that represent COM components cannot be cast to types that do not represent COM components; however they can be cast to interfaces as long as the underlying COM component supports QueryInterface calls for the IID of the interface.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to class type 'System.Data.SqlClient.SqlConnection'. Instances of types that represent COM components cannot be cast to types that do not represent COM components; however they can be cast to interfaces as long as the underlying COM component supports QueryInterface calls for the IID of the interface.

Re: Opening an SQL Connection

Here is my full connection string...feel free to critique my coding methods as I am new to this and would like to become better, also please let me know what exactly you would do to change my code. You've been a great help so far!

Re: Opening an SQL Connection

I have found the cause of that problem and have fixed it. However I am still having problems related to it. One of my close friends is very proficient in ASP.NET so he has also given me some edits that have worked. Thanks for your help and I'll repost with any other issues I think you might know.

I had specified the UID and PWD for the Sql Server 2008 account in the connection string as well as being logged onto the admin account of this computer. If you know any possible reason for this, please let me know. Thanks!

Re: Opening an SQL Connection

You really should not be using Master as your database.
You should istead create a new database for your project.
This may be the source of your porblem.
You also may want to check the permissions of the login you are using with sql server.

Re: Opening an SQL Connection

I fixed the problem. I went ahead and created a new database and didn't use master. It didn't immediately solve the problem but I did get it working after altering authentication settings in the SQL Management Studio program. The search function works now. The only problems I'm having now is I can only execute a one word search that exactly matches a result in a column, I don't know how to set up a "hyperlink" to one of the result column to link it to a file hosted on the computer, and some server issues which can be addressed later. If you know answers or solutions to the first two please let me know and thanks for your previous and continued help!!!

Re: Opening an SQL Connection

The only problems I'm having now is I can only execute a one word search that exactly matches a result in a column, I don't know how to set up a "hyperlink" to one of the result column to link it to a file hosted on the computer

I think you will need to provide more information. I am not sure what you mean here.

What did you try?
What do you want to be able to do?
What was the result you got?
If any errors occurred what were they?