Showing posts with label sqlserver2005. Show all posts
Showing posts with label sqlserver2005. Show all posts

Friday, March 30, 2012

how can i connect to sqlserver2005 express by ado

hr = m_pConnection.CreateInstance("ADODB.Connection");
if (SUCCEEDED(hr))
{
if (FAILED(m_pConnection->Open("Provider = sqloledb;Server=(local);Database=c863;Trusted_Connection=yes","","",-1)))
{
AfxMessageBox("Can not open Database!");
m_pConnection.Release();
return FALSE;
}

}
when i debug ,there is an exception at "m_pConnection->Open("Provider = sqloledb;Server=(local);Database=c863;Trusted_Connection=yes","","",-1)))"
the exception is
'Book.exe': Loaded 'C:\Program Files\Common Files\System\Ole DB\sqloledb.rll', Binary was not built with debug information.
First-chance exception at 0x7c81eb33 in Book.exe: Microsoft C++ exception: _com_error at memory location 0x0013fba4..
how should i do?

Try

Server=(local)\SQLEXPRESS

SQL Express is installed as a "named" instance by default, an drequires the instance name specification when making a connection (as opposed to a "default" instance).|||Sorry,it dont still work.the exception is
"First-chance exception at 0x7c81eb33 in Book.exe: Microsoft C++ exception: _com_error at memory location 0x0013fba4.."|||It looks like the failure may be unrelated to your connection string.

>> First-chance exception at 0x7c81eb33 in Book.exe: Microsoft C++ exception: _com_error at memory location 0x0013fba4.

Try running your application with a debugger attached and breaking at the point the exception occurs. This will likely give you more insight into the cause of the problem.

Hope this helps,
Vaughn

how can i connect to sqlserver2005 express by ado

hr = m_pConnection.CreateInstance("ADODB.Connection");
if (SUCCEEDED(hr))
{
if (FAILED(m_pConnection->Open("Provider = sqloledb;Server=(local);Database=c863;Trusted_Connection=yes","","",-1)))
{
AfxMessageBox("Can not open Database!");
m_pConnection.Release();
return FALSE;
}

}
when i debug ,there is an exception at "m_pConnection->Open("Provider = sqloledb;Server=(local);Database=c863;Trusted_Connection=yes","","",-1)))"
the exception is
'Book.exe': Loaded 'C:\Program Files\Common Files\System\Ole DB\sqloledb.rll', Binary was not built with debug information.
First-chance exception at 0x7c81eb33 in Book.exe: Microsoft C++ exception: _com_error at memory location 0x0013fba4..
how should i do?Try

Server=(local)\SQLEXPRESS

SQL Express is installed as a "named" instance by default, an drequires the instance name specification when making a connection (as opposed to a "default" instance).|||Sorry,it dont still work.the exception is
"First-chance exception at 0x7c81eb33 in Book.exe: Microsoft C++ exception: _com_error at memory location 0x0013fba4.."
|||It looks like the failure may be unrelated to your connection string.

>> First-chance exception at 0x7c81eb33 in Book.exe: Microsoft C++ exception: _com_error at memory location 0x0013fba4.

Try running your application with a debugger attached and breaking at the point the exception occurs. This will likely give you more insight into the cause of the problem.

Hope this helps,
Vaughnsql

How can i connect to Sqlserver2000 from sqlserver2005

Hi,

Can any1 tell me how to connect to Sqlserver2000 from sqlserver2005 ...I cant see sqlserver2000 instance name when i try to search in database engine

With regards

mahender

I assume you're talking about using SSMS and you can't see your sql2k instance?

When you click "browse" button, the application send a broadcast onto the network on UDP 1434 to get a list of available sql instances from sqlbrowsers. If the sqlbrowser port is blocked or it's not running on the node where your sql2k instance resides, you would not get a reply back. This does not mean, however, that you cannot connect to your instance. If this is a default instance, you can just specify the servername explicitly and the application (ssms) should connect. If it is a named instance, you will need to specify the listening tcp port (e.g. servername,12345) to connect (this assumes your sqlbrowser is not running).

If you're talking about creating a connection between the two servers, you will want to look for "sp_addlinkedserver" in book online. There should be detailed info to walk you through.

Monday, March 26, 2012

How can I change password of SQLServer2005/Expres ?

ow can I change password of SQLServer2005/Expres ?You mean the sa password? You can change it using Management Studio and goign to edit the login.

Wednesday, March 21, 2012

How can i attach a SQLServer2005 db to an instance of SQLServer 2000?

i have a db that created in sql2000 and then iattached it to sqlserver 2005 ,now i want to attach this db to sql server 2000 again,but when i do that i get an error message and the attach process fails.plz help me and show me a way to attach this db.

Short answer: you can't :-(
Once you have attached it to SQL Server 2005 it is no longer compatible with the SQL Server 2000 file format.