Showing posts with label errors. Show all posts
Showing posts with label errors. Show all posts

Thursday, March 22, 2012

cannot P/Invoke SQLCEME30.DLL when debugging Pocket PC 2003 SE Emulator

I'm trying to debug an assembly with System.Data.SqlServerCe - and when I deploy to a IPAQ 2210 - I get no errors! Alas, when I try to debug using the Pocket PC 2003 SE Emulator - I get the "cannot P/Invoke SQLCEME30.DLL" exception.

Can anyone offer directions?

best regards,
Walther

wDiechmann wrote:

I'm trying to debug an assembly with System.Data.SqlServerCe - and when I deploy to a IPAQ 2210 - I get no errors! Alas, when I try to debug using the Pocket PC 2003 SE Emulator - I get the "cannot P/Invoke SQLCEME30.DLL" exception.

Can anyone offer directions?

best regards,
Walther

I tried with a SmallTestProject having nothing except statements to create new "test.sdf" and my take on this is: you cannot debug solutions for smart devices aka Pocket PC 2003 in VS2005, if you want to use the emulator!

Please someone prove me wrong!

a nice weekend from sunny Denmark,
Walther|||

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=604751&SiteID=1

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=438553&SiteID=1

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=220816&SiteID=1

|||So are you meant to install the SQLMobile CAB file on the emulator? How will it know that you unstalled the CAB file the last time you loaded up the emulator?

I don't undertstand this.|||

I'm not sure what exactly you do not understand.

You copy the CAB, you click on it - it's now installed. If you save emulator state, it would remain installed. If you don't save the emulator's state - it's all gone on restart, repeat the installation every time emulator is started (or save state).

|||Ahh, right, get you now :)

I didn't know the Emulator state saved things like that (installation of things) :)

I'm guessing that each device model/version has its own emulator state?|||Ilya Tumanov,

I'm afraid I do not see where you're taking me on this!

I debug my apps perfectly allright on the device - but I'm not able to debug apps using the emulator (where no device is involved - just my desktop)

The links you threw my way all talk about copying CABs to the device - but I'm not debugging on the device. I'm debugging on the emulator!?

Sorry if my english is not fluently enough to present my case properly :(

best regards,
Walther|||OK, Walther, judging by what Ilya as stated, you need to install the SQL CAB's onto the Emulator.

To do this, in VS 2005 go to 'Tools'->'Device Emulator Manager', then in the available Emulators select the Emulator you need then go to 'Actions'->'Connect' (wait for Green tick next to Emulator). Then in the Emulator Window go to 'File'->'Configure', then under the 'General' tab in the 'Shared Folder', click the '...' button. Locate to the Bin/debug directory of your application, and ok that. In this directory you should have placed your SQL CAB files.

Now in the Emulator, click 'Start'->'Programs'->'File Explorer'->'My Device'->'Storage Card' - in here should be your CAB files, click on them to install them. Remember to save the Emulator state.

Ilya, is this the correct way of doing it, or is there an easier way?

Thanks
|||

Normally VS 2005 would install NETCF and SQL Mobile automatically as soon as you hit F5. If for some reason that does not work, then installation via mapped folder should work.

As device vs. emulator, there's no difference in this case. You see, emulator is a device, only simulated. You can even Active Sync it if you want in copy files via AS just like you would do with physical device.

cannot P/Invoke SQLCEME30.DLL when debugging Pocket PC 2003 SE Emulator

I'm trying to debug an assembly with System.Data.SqlServerCe - and when I deploy to a IPAQ 2210 - I get no errors! Alas, when I try to debug using the Pocket PC 2003 SE Emulator - I get the "cannot P/Invoke SQLCEME30.DLL" exception.

Can anyone offer directions?

best regards,
Walther

wDiechmann wrote:

I'm trying to debug an assembly with System.Data.SqlServerCe - and when I deploy to a IPAQ 2210 - I get no errors! Alas, when I try to debug using the Pocket PC 2003 SE Emulator - I get the "cannot P/Invoke SQLCEME30.DLL" exception.

Can anyone offer directions?

best regards,
Walther

I tried with a SmallTestProject havingnothing except statements to create new "test.sdf" and my take on this is: you cannot debug solutions for smart devices aka Pocket PC 2003 in VS2005, if you want to use the emulator!

Please someone prove me wrong!

a nice weekend from sunny Denmark,
Walther
|||

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=604751&SiteID=1

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=438553&SiteID=1

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=220816&SiteID=1

|||So are you meant to install the SQLMobile CAB file on the emulator? How will it know that you unstalled the CAB file the last time you loaded up the emulator?

I don't undertstand this.|||

I'm not sure what exactly you do not understand.

You copy the CAB, you click on it - it's now installed. If you save emulator state, it would remain installed. If you don't save the emulator's state - it's all gone on restart, repeat the installation every time emulator is started (or save state).

|||Ahh, right, get you now :)

I didn't know the Emulator state saved things like that (installation of things) :)

I'm guessing that each device model/version has its own emulator state?|||Ilya Tumanov,

I'm afraid I do not see where you're taking me on this!

I debug my apps perfectly allright on the device - but I'm not able to debug apps using the emulator (where no device is involved - just my desktop)

The links you threw my way all talk about copying CABs to the device - but I'm not debugging on the device. I'm debugging on the emulator!?

Sorry if my english is not fluently enough to present my case properly :(

best regards,
Walther
|||OK, Walther, judging by whatIlya as stated, you need to install the SQL CAB's onto the Emulator.

To do this, in VS 2005 go to 'Tools'->'Device Emulator Manager', then in the available Emulators select the Emulator you need then go to 'Actions'->'Connect' (wait for Green tick next to Emulator). Then in the Emulator Window go to 'File'->'Configure', then under the 'General' tab in the 'Shared Folder', click the '...' button. Locate to the Bin/debug directory of your application, and ok that. In this directory you should have placed your SQL CAB files.

Now in the Emulator, click 'Start'->'Programs'->'File Explorer'->'My Device'->'Storage Card' - in here should be your CAB files, click on them to install them. Remember to save the Emulator state.

Ilya, is this the correct way of doing it, or is there an easier way?

Thanks
|||

Normally VS 2005 would install NETCF and SQL Mobile automatically as soon as you hit F5. If for some reason that does not work, then installation via mapped folder should work.

As device vs. emulator, there's no difference in this case. You see, emulator is a device, only simulated. You can even Active Sync it if you want in copy files via AS just like you would do with physical device.

Cannot open user default database. Login failed. Login failed for user 'UserName'. (Microsoft

Hi,

SQL Server 2005 installed on my computer. i was trying to make a login page with VS.2005 pro. But i got some errors on Website Administration Tool. Whatsoever, i registered a database (aspnetdb) . Then, i think i made my default database to aspnetdb. Something went wrong and i decided to delete aspnetdb and start whole procces from the begining and i did it. AAANDD WHOOOLA. I got this error:

Cannot Open User Default Database, Login Failed
Microsoft SQL Server, Error 4064

Is there anyway to change my default database to "master" again? Or simply will i uninstall all the sql server 2005?
(?f you say uninstall, answer this:: Will be any problem on VS 2005? I can't uninstall both :) )

You should determine what is the login you are connecting at, then login as administrator and issue an ALTER LOGIN statement to set the default database for that login to master. See Books Online for additional information on using the ALTER LOGIN statement.

Thanks
Laurentiu|||I don't think that Laurentiu understands the problem. I have run into the same situation, I am an administrator on the server, because the default database no longer exists (I had changed it from master) I can no longer connect. I would like to think that in the absence of my default database, it would revert to the master, but this is not the case. I'm unable to connect using the Administrator login to execute the ALTER LOGIN command.|||

You can resolve this by specifying another database you want to connect to; master, for example. Then you can reset the login's default database. With sqlcmd, you can do the following:

sqlcmd -d master -U sa -P mypassword

and then:

alter login sa with default_database = master

Thanks
Laurentiu

|||I've googled this error message and I get a hundred hits. Shouldn't there be a KB? I have exactly the same problem. I changed the default DB, then dropped it. I have no idea what the sa password is. Do I need to uninstall/reinstall SS05?|||

I already posted an answer above. You just need to specify a different database to use at connection time, then change your default database to an existing one.

I'll check to see if we have a KB article on this and pass your feedback to write one if we don't already have it.

Thanks
Laurentiu

|||

I see now that you mentioned that you don't know sa's password.

sa was just provided as an example, for this operation you don't necessarily need to use sa to connect. You just need to connect with the login for which you've received this error. If you use Windows authentication, then you should connect like this:

sqlcmd -E -d master

then issue the ALTER LOGIN statement.

It's the "-d master" that's the key here - it specifies that the connection should be made to the master database, so the login won't try to connect to the database that no longer exists.

Hope this makes the solution clearer. If you still have problems with resetting the default database, let us know.

Thanks
Laurentiu

|||To me this seems like a bug with Sql Server Management Studio, as you can connect to the database by specifing the database under options. You cannot however change the user's default database as right click -> properties tries to make a new connection using the default database. As far as I can see, it should create the new connection with the same database specified in the options section?|||

You should post to SQL Server Tools General, for Management Studio issues. You can also search for existing bugs on this issue or open a new one at: http://lab.msdn.microsoft.com/productfeedback/.

Thanks
Laurentiu

|||

I got the same error with SQL Server Management Studio and could not resolve it with sa authentication because my config wouldn't let me log in as sa.

Selecting master as the connect database in the login dialog got me in. I then tried to edit my login object to change my default database, but this fails with the same error!

I then tried deleting my login. Failed again with error 4064.

Finally, I tried to right-click on the login object, and selected Script Login As > DROP to > New Query Editor Window, and then hit Execute in the view that appeared. It worked!

Hope this helps someone out there...

|||

I just ran into the same issue after I dropped a database that was mistakenly set to be the default database. I found the information posted here pointed me in the right direction, but it didn't really help much because I couldn't figure out which user should be modified when SQL Server 2005 is configured to use Windows authentication (e.g. trusted connections) exclusively. After a lot of digging through SQL Server Books Online, executing various stored procedures to dump login information, and experimentation, I finally stumbled on the right combination.

C:\> sqlcmd -E -d master

1> ALTER LOGIN [BUILTIN\Administrators] WITH DEFAULT_DATABASE=master

2> GO

I show the prompts above so you can see where to type the commands and the expected results (e.g. SQLCMD does not output any information or error messages).

|||

I detached a database on a network server with the idea of reattaching an updated version from my local db.

Evidently, the database I detached was the default database. I couldn't log in now because of the posts in this thread. I was able to log in using the Master db at the login dialog. However, I've tried everything in this post, and nothing seems to work!

When I try to execute a query against the master db (such as the sql in these posts), it executes fine. In the drop down list of available databases, the only thing it has is master... the rest says "server is not available". I'm able to ping it just fine.

I can't even restore the db I detached, because I get the same error msgs as not being able to log on. I desperately need to attach this database again with master as the default db.

How can I accomplish this? Can someone please help?

|||

The only thing I can do with logging in as master, is simply just to look at objects. I cannot perform any action at all against anything because of the same error message (Cannot open user default database. Login failed for user sa...).

How can I resolve this!!!!

Microsoft, please help..........

|||For what it's worth, the db icazon next to the server is simply a white circle (no activity, etc)....|||

I tried what you're mentioning Chris and it didn't work.

In the query window I have the following:

IF EXISTS (SELECT * FROM sys.server_principals WHERE name = N'sa')

DROP LOGIN [sa]

The results state the following:

Msg 15405, Level 16, State 1, Line 3

Cannot use the special principal 'sa'.

Cannot open user default database. Login failed. Login failed for user 'UserName'. (Microsoft

Hi,

SQL Server 2005 installed on my computer. i was trying to make a login page with VS.2005 pro. But i got some errors on Website Administration Tool. Whatsoever, i registered a database (aspnetdb) . Then, i think i made my default database to aspnetdb. Something went wrong and i decided to delete aspnetdb and start whole procces from the begining and i did it. AAANDD WHOOOLA. I got this error:

Cannot Open User Default Database, Login Failed
Microsoft SQL Server, Error 4064

Is there anyway to change my default database to "master" again? Or simply will i uninstall all the sql server 2005?
(?f you say uninstall, answer this:: Will be any problem on VS 2005? I can't uninstall both :) )

You should determine what is the login you are connecting at, then login as administrator and issue an ALTER LOGIN statement to set the default database for that login to master. See Books Online for additional information on using the ALTER LOGIN statement.

Thanks
Laurentiu|||I don't think that Laurentiu understands the problem. I have run into the same situation, I am an administrator on the server, because the default database no longer exists (I had changed it from master) I can no longer connect. I would like to think that in the absence of my default database, it would revert to the master, but this is not the case. I'm unable to connect using the Administrator login to execute the ALTER LOGIN command.|||

You can resolve this by specifying another database you want to connect to; master, for example. Then you can reset the login's default database. With sqlcmd, you can do the following:

sqlcmd -d master -U sa -P mypassword

and then:

alter login sa with default_database = master

Thanks
Laurentiu

|||I've googled this error message and I get a hundred hits. Shouldn't there be a KB? I have exactly the same problem. I changed the default DB, then dropped it. I have no idea what the sa password is. Do I need to uninstall/reinstall SS05?|||

I already posted an answer above. You just need to specify a different database to use at connection time, then change your default database to an existing one.

I'll check to see if we have a KB article on this and pass your feedback to write one if we don't already have it.

Thanks
Laurentiu

|||

I see now that you mentioned that you don't know sa's password.

sa was just provided as an example, for this operation you don't necessarily need to use sa to connect. You just need to connect with the login for which you've received this error. If you use Windows authentication, then you should connect like this:

sqlcmd -E -d master

then issue the ALTER LOGIN statement.

It's the "-d master" that's the key here - it specifies that the connection should be made to the master database, so the login won't try to connect to the database that no longer exists.

Hope this makes the solution clearer. If you still have problems with resetting the default database, let us know.

Thanks
Laurentiu

|||To me this seems like a bug with Sql Server Management Studio, as you can connect to the database by specifing the database under options. You cannot however change the user's default database as right click -> properties tries to make a new connection using the default database. As far as I can see, it should create the new connection with the same database specified in the options section?|||

You should post to SQL Server Tools General, for Management Studio issues. You can also search for existing bugs on this issue or open a new one at: http://lab.msdn.microsoft.com/productfeedback/.

Thanks
Laurentiu

|||

I got the same error with SQL Server Management Studio and could not resolve it with sa authentication because my config wouldn't let me log in as sa.

Selecting master as the connect database in the login dialog got me in. I then tried to edit my login object to change my default database, but this fails with the same error!

I then tried deleting my login. Failed again with error 4064.

Finally, I tried to right-click on the login object, and selected Script Login As > DROP to > New Query Editor Window, and then hit Execute in the view that appeared. It worked!

Hope this helps someone out there...

|||

I just ran into the same issue after I dropped a database that was mistakenly set to be the default database. I found the information posted here pointed me in the right direction, but it didn't really help much because I couldn't figure out which user should be modified when SQL Server 2005 is configured to use Windows authentication (e.g. trusted connections) exclusively. After a lot of digging through SQL Server Books Online, executing various stored procedures to dump login information, and experimentation, I finally stumbled on the right combination.

C:\> sqlcmd -E -d master

1> ALTER LOGIN [BUILTIN\Administrators] WITH DEFAULT_DATABASE=master

2> GO

I show the prompts above so you can see where to type the commands and the expected results (e.g. SQLCMD does not output any information or error messages).

|||

I detached a database on a network server with the idea of reattaching an updated version from my local db.

Evidently, the database I detached was the default database. I couldn't log in now because of the posts in this thread. I was able to log in using the Master db at the login dialog. However, I've tried everything in this post, and nothing seems to work!

When I try to execute a query against the master db (such as the sql in these posts), it executes fine. In the drop down list of available databases, the only thing it has is master... the rest says "server is not available". I'm able to ping it just fine.

I can't even restore the db I detached, because I get the same error msgs as not being able to log on. I desperately need to attach this database again with master as the default db.

How can I accomplish this? Can someone please help?

|||

The only thing I can do with logging in as master, is simply just to look at objects. I cannot perform any action at all against anything because of the same error message (Cannot open user default database. Login failed for user sa...).

How can I resolve this!!!!

Microsoft, please help..........

|||For what it's worth, the db icazon next to the server is simply a white circle (no activity, etc)....|||

I tried what you're mentioning Chris and it didn't work.

In the query window I have the following:

IF EXISTS (SELECT * FROM sys.server_principals WHERE name = N'sa')

DROP LOGIN [sa]

The results state the following:

Msg 15405, Level 16, State 1, Line 3

Cannot use the special principal 'sa'.

sql

Cannot Open User Default Database (error 4064)

Hi,

SQL Server 2005 installed on my computer. i was trying to make a login page with VS.2005 pro. But i got some errors on Website Administration Tool. Whatsoever, i registered a database (aspnetdb) . Then, i think i made my default database to aspnetdb. Something went wrong and i decided to delete aspnetdb and start whole procces from the begining and i did it. AAANDD WHOOOLA. I got this error:

Cannot Open User Default Database, Login Failed
Microsoft SQL Server, Error 4064

Is there anyway to change my default database to "master" again? Or simply will i uninstall all the sql server 2005?
(?f you say uninstall, answer this:: Will be any problem on VS 2005? I can't uninstall both :) )

You should determine what is the login you are connecting at, then login as administrator and issue an ALTER LOGIN statement to set the default database for that login to master. See Books Online for additional information on using the ALTER LOGIN statement.

Thanks
Laurentiu|||I don't think that Laurentiu understands the problem. I have run into the same situation, I am an administrator on the server, because the default database no longer exists (I had changed it from master) I can no longer connect. I would like to think that in the absence of my default database, it would revert to the master, but this is not the case. I'm unable to connect using the Administrator login to execute the ALTER LOGIN command.|||

You can resolve this by specifying another database you want to connect to; master, for example. Then you can reset the login's default database. With sqlcmd, you can do the following:

sqlcmd -d master -U sa -P mypassword

and then:

alter login sa with default_database = master

Thanks
Laurentiu

|||I've googled this error message and I get a hundred hits. Shouldn't there be a KB? I have exactly the same problem. I changed the default DB, then dropped it. I have no idea what the sa password is. Do I need to uninstall/reinstall SS05?|||

I already posted an answer above. You just need to specify a different database to use at connection time, then change your default database to an existing one.

I'll check to see if we have a KB article on this and pass your feedback to write one if we don't already have it.

Thanks
Laurentiu

|||

I see now that you mentioned that you don't know sa's password.

sa was just provided as an example, for this operation you don't necessarily need to use sa to connect. You just need to connect with the login for which you've received this error. If you use Windows authentication, then you should connect like this:

sqlcmd -E -d master

then issue the ALTER LOGIN statement.

It's the "-d master" that's the key here - it specifies that the connection should be made to the master database, so the login won't try to connect to the database that no longer exists.

Hope this makes the solution clearer. If you still have problems with resetting the default database, let us know.

Thanks
Laurentiu

|||To me this seems like a bug with Sql Server Management Studio, as you can connect to the database by specifing the database under options. You cannot however change the user's default database as right click -> properties tries to make a new connection using the default database. As far as I can see, it should create the new connection with the same database specified in the options section?|||

You should post to SQL Server Tools General, for Management Studio issues. You can also search for existing bugs on this issue or open a new one at: http://lab.msdn.microsoft.com/productfeedback/.

Thanks
Laurentiu

|||

I got the same error with SQL Server Management Studio and could not resolve it with sa authentication because my config wouldn't let me log in as sa.

Selecting master as the connect database in the login dialog got me in. I then tried to edit my login object to change my default database, but this fails with the same error!

I then tried deleting my login. Failed again with error 4064.

Finally, I tried to right-click on the login object, and selected Script Login As > DROP to > New Query Editor Window, and then hit Execute in the view that appeared. It worked!

Hope this helps someone out there...

|||

I just ran into the same issue after I dropped a database that was mistakenly set to be the default database. I found the information posted here pointed me in the right direction, but it didn't really help much because I couldn't figure out which user should be modified when SQL Server 2005 is configured to use Windows authentication (e.g. trusted connections) exclusively. After a lot of digging through SQL Server Books Online, executing various stored procedures to dump login information, and experimentation, I finally stumbled on the right combination.

C:\> sqlcmd -E -d master

1> ALTER LOGIN [BUILTIN\Administrators] WITH DEFAULT_DATABASE=master

2> GO

I show the prompts above so you can see where to type the commands and the expected results (e.g. SQLCMD does not output any information or error messages).

|||

I detached a database on a network server with the idea of reattaching an updated version from my local db.

Evidently, the database I detached was the default database. I couldn't log in now because of the posts in this thread. I was able to log in using the Master db at the login dialog. However, I've tried everything in this post, and nothing seems to work!

When I try to execute a query against the master db (such as the sql in these posts), it executes fine. In the drop down list of available databases, the only thing it has is master... the rest says "server is not available". I'm able to ping it just fine.

I can't even restore the db I detached, because I get the same error msgs as not being able to log on. I desperately need to attach this database again with master as the default db.

How can I accomplish this? Can someone please help?

|||

The only thing I can do with logging in as master, is simply just to look at objects. I cannot perform any action at all against anything because of the same error message (Cannot open user default database. Login failed for user sa...).

How can I resolve this!!!!

Microsoft, please help..........

|||For what it's worth, the db icazon next to the server is simply a white circle (no activity, etc)....|||

I tried what you're mentioning Chris and it didn't work.

In the query window I have the following:

IF EXISTS (SELECT * FROM sys.server_principals WHERE name = N'sa')

DROP LOGIN [sa]

The results state the following:

Msg 15405, Level 16, State 1, Line 3

Cannot use the special principal 'sa'.

Cannot Open User Default Database (error 4064)

Hi,

SQL Server 2005 installed on my computer. i was trying to make a login page with VS.2005 pro. But i got some errors on Website Administration Tool. Whatsoever, i registered a database (aspnetdb) . Then, i think i made my default database to aspnetdb. Something went wrong and i decided to delete aspnetdb and start whole procces from the begining and i did it. AAANDD WHOOOLA. I got this error:

Cannot Open User Default Database, Login Failed
Microsoft SQL Server, Error 4064

Is there anyway to change my default database to "master" again? Or simply will i uninstall all the sql server 2005?
(?f you say uninstall, answer this:: Will be any problem on VS 2005? I can't uninstall both :) )

You should determine what is the login you are connecting at, then login as administrator and issue an ALTER LOGIN statement to set the default database for that login to master. See Books Online for additional information on using the ALTER LOGIN statement.

Thanks
Laurentiu|||I don't think that Laurentiu understands the problem. I have run into the same situation, I am an administrator on the server, because the default database no longer exists (I had changed it from master) I can no longer connect. I would like to think that in the absence of my default database, it would revert to the master, but this is not the case. I'm unable to connect using the Administrator login to execute the ALTER LOGIN command.|||

You can resolve this by specifying another database you want to connect to; master, for example. Then you can reset the login's default database. With sqlcmd, you can do the following:

sqlcmd -d master -U sa -P mypassword

and then:

alter login sa with default_database = master

Thanks
Laurentiu

|||I've googled this error message and I get a hundred hits. Shouldn't there be a KB? I have exactly the same problem. I changed the default DB, then dropped it. I have no idea what the sa password is. Do I need to uninstall/reinstall SS05?|||

I already posted an answer above. You just need to specify a different database to use at connection time, then change your default database to an existing one.

I'll check to see if we have a KB article on this and pass your feedback to write one if we don't already have it.

Thanks
Laurentiu

|||

I see now that you mentioned that you don't know sa's password.

sa was just provided as an example, for this operation you don't necessarily need to use sa to connect. You just need to connect with the login for which you've received this error. If you use Windows authentication, then you should connect like this:

sqlcmd -E -d master

then issue the ALTER LOGIN statement.

It's the "-d master" that's the key here - it specifies that the connection should be made to the master database, so the login won't try to connect to the database that no longer exists.

Hope this makes the solution clearer. If you still have problems with resetting the default database, let us know.

Thanks
Laurentiu

|||To me this seems like a bug with Sql Server Management Studio, as you can connect to the database by specifing the database under options. You cannot however change the user's default database as right click -> properties tries to make a new connection using the default database. As far as I can see, it should create the new connection with the same database specified in the options section?|||

You should post to SQL Server Tools General, for Management Studio issues. You can also search for existing bugs on this issue or open a new one at: http://lab.msdn.microsoft.com/productfeedback/.

Thanks
Laurentiu

|||

I got the same error with SQL Server Management Studio and could not resolve it with sa authentication because my config wouldn't let me log in as sa.

Selecting master as the connect database in the login dialog got me in. I then tried to edit my login object to change my default database, but this fails with the same error!

I then tried deleting my login. Failed again with error 4064.

Finally, I tried to right-click on the login object, and selected Script Login As > DROP to > New Query Editor Window, and then hit Execute in the view that appeared. It worked!

Hope this helps someone out there...

|||

I just ran into the same issue after I dropped a database that was mistakenly set to be the default database. I found the information posted here pointed me in the right direction, but it didn't really help much because I couldn't figure out which user should be modified when SQL Server 2005 is configured to use Windows authentication (e.g. trusted connections) exclusively. After a lot of digging through SQL Server Books Online, executing various stored procedures to dump login information, and experimentation, I finally stumbled on the right combination.

C:\> sqlcmd -E -d master

1> ALTER LOGIN [BUILTIN\Administrators] WITH DEFAULT_DATABASE=master

2> GO

I show the prompts above so you can see where to type the commands and the expected results (e.g. SQLCMD does not output any information or error messages).

|||

I detached a database on a network server with the idea of reattaching an updated version from my local db.

Evidently, the database I detached was the default database. I couldn't log in now because of the posts in this thread. I was able to log in using the Master db at the login dialog. However, I've tried everything in this post, and nothing seems to work!

When I try to execute a query against the master db (such as the sql in these posts), it executes fine. In the drop down list of available databases, the only thing it has is master... the rest says "server is not available". I'm able to ping it just fine.

I can't even restore the db I detached, because I get the same error msgs as not being able to log on. I desperately need to attach this database again with master as the default db.

How can I accomplish this? Can someone please help?

|||

The only thing I can do with logging in as master, is simply just to look at objects. I cannot perform any action at all against anything because of the same error message (Cannot open user default database. Login failed for user sa...).

How can I resolve this!!!!

Microsoft, please help..........

|||For what it's worth, the db icazon next to the server is simply a white circle (no activity, etc)....|||

I tried what you're mentioning Chris and it didn't work.

In the query window I have the following:

IF EXISTS (SELECT * FROM sys.server_principals WHERE name = N'sa')

DROP LOGIN [sa]

The results state the following:

Msg 15405, Level 16, State 1, Line 3

Cannot use the special principal 'sa'.

Cannot Open User Default Database (error 4064)

Hi,

SQL Server 2005 installed on my computer. i was trying to make a login page with VS.2005 pro. But i got some errors on Website Administration Tool. Whatsoever, i registered a database (aspnetdb) . Then, i think i made my default database to aspnetdb. Something went wrong and i decided to delete aspnetdb and start whole procces from the begining and i did it. AAANDD WHOOOLA. I got this error:

Cannot Open User Default Database, Login Failed
Microsoft SQL Server, Error 4064

Is there anyway to change my default database to "master" again? Or simply will i uninstall all the sql server 2005?
(?f you say uninstall, answer this:: Will be any problem on VS 2005? I can't uninstall both :) )

You should determine what is the login you are connecting at, then login as administrator and issue an ALTER LOGIN statement to set the default database for that login to master. See Books Online for additional information on using the ALTER LOGIN statement.

Thanks
Laurentiu|||I don't think that Laurentiu understands the problem. I have run into the same situation, I am an administrator on the server, because the default database no longer exists (I had changed it from master) I can no longer connect. I would like to think that in the absence of my default database, it would revert to the master, but this is not the case. I'm unable to connect using the Administrator login to execute the ALTER LOGIN command.|||

You can resolve this by specifying another database you want to connect to; master, for example. Then you can reset the login's default database. With sqlcmd, you can do the following:

sqlcmd -d master -U sa -P mypassword

and then:

alter login sa with default_database = master

Thanks
Laurentiu

|||I've googled this error message and I get a hundred hits. Shouldn't there be a KB? I have exactly the same problem. I changed the default DB, then dropped it. I have no idea what the sa password is. Do I need to uninstall/reinstall SS05?|||

I already posted an answer above. You just need to specify a different database to use at connection time, then change your default database to an existing one.

I'll check to see if we have a KB article on this and pass your feedback to write one if we don't already have it.

Thanks
Laurentiu

|||

I see now that you mentioned that you don't know sa's password.

sa was just provided as an example, for this operation you don't necessarily need to use sa to connect. You just need to connect with the login for which you've received this error. If you use Windows authentication, then you should connect like this:

sqlcmd -E -d master

then issue the ALTER LOGIN statement.

It's the "-d master" that's the key here - it specifies that the connection should be made to the master database, so the login won't try to connect to the database that no longer exists.

Hope this makes the solution clearer. If you still have problems with resetting the default database, let us know.

Thanks
Laurentiu

|||To me this seems like a bug with Sql Server Management Studio, as you can connect to the database by specifing the database under options. You cannot however change the user's default database as right click -> properties tries to make a new connection using the default database. As far as I can see, it should create the new connection with the same database specified in the options section?|||

You should post to SQL Server Tools General, for Management Studio issues. You can also search for existing bugs on this issue or open a new one at: http://lab.msdn.microsoft.com/productfeedback/.

Thanks
Laurentiu

|||

I got the same error with SQL Server Management Studio and could not resolve it with sa authentication because my config wouldn't let me log in as sa.

Selecting master as the connect database in the login dialog got me in. I then tried to edit my login object to change my default database, but this fails with the same error!

I then tried deleting my login. Failed again with error 4064.

Finally, I tried to right-click on the login object, and selected Script Login As > DROP to > New Query Editor Window, and then hit Execute in the view that appeared. It worked!

Hope this helps someone out there...

|||

I just ran into the same issue after I dropped a database that was mistakenly set to be the default database. I found the information posted here pointed me in the right direction, but it didn't really help much because I couldn't figure out which user should be modified when SQL Server 2005 is configured to use Windows authentication (e.g. trusted connections) exclusively. After a lot of digging through SQL Server Books Online, executing various stored procedures to dump login information, and experimentation, I finally stumbled on the right combination.

C:\> sqlcmd -E -d master

1> ALTER LOGIN [BUILTIN\Administrators] WITH DEFAULT_DATABASE=master

2> GO

I show the prompts above so you can see where to type the commands and the expected results (e.g. SQLCMD does not output any information or error messages).

|||

I detached a database on a network server with the idea of reattaching an updated version from my local db.

Evidently, the database I detached was the default database. I couldn't log in now because of the posts in this thread. I was able to log in using the Master db at the login dialog. However, I've tried everything in this post, and nothing seems to work!

When I try to execute a query against the master db (such as the sql in these posts), it executes fine. In the drop down list of available databases, the only thing it has is master... the rest says "server is not available". I'm able to ping it just fine.

I can't even restore the db I detached, because I get the same error msgs as not being able to log on. I desperately need to attach this database again with master as the default db.

How can I accomplish this? Can someone please help?

|||

The only thing I can do with logging in as master, is simply just to look at objects. I cannot perform any action at all against anything because of the same error message (Cannot open user default database. Login failed for user sa...).

How can I resolve this!!!!

Microsoft, please help..........

|||For what it's worth, the db icazon next to the server is simply a white circle (no activity, etc)....|||

I tried what you're mentioning Chris and it didn't work.

In the query window I have the following:

IF EXISTS (SELECT * FROM sys.server_principals WHERE name = N'sa')

DROP LOGIN [sa]

The results state the following:

Msg 15405, Level 16, State 1, Line 3

Cannot use the special principal 'sa'.

sql

Cannot Open User Default Database (error 4064)

Hi,

SQL Server 2005 installed on my computer. i was trying to make a login page with VS.2005 pro. But i got some errors on Website Administration Tool. Whatsoever, i registered a database (aspnetdb) . Then, i think i made my default database to aspnetdb. Something went wrong and i decided to delete aspnetdb and start whole procces from the begining and i did it. AAANDD WHOOOLA. I got this error:

Cannot Open User Default Database, Login Failed
Microsoft SQL Server, Error 4064

Is there anyway to change my default database to "master" again? Or simply will i uninstall all the sql server 2005?
(?f you say uninstall, answer this:: Will be any problem on VS 2005? I can't uninstall both :) )You should determine what is the login you are connecting at, then login as administrator and issue an ALTER LOGIN statement to set the default database for that login to master. See Books Online for additional information on using the ALTER LOGIN statement.

Thanks
Laurentiu|||I don't think that Laurentiu understands the problem. I have run into the same situation, I am an administrator on the server, because the default database no longer exists (I had changed it from master) I can no longer connect. I would like to think that in the absence of my default database, it would revert to the master, but this is not the case. I'm unable to connect using the Administrator login to execute the ALTER LOGIN command.|||

You can resolve this by specifying another database you want to connect to; master, for example. Then you can reset the login's default database. With sqlcmd, you can do the following:

sqlcmd -d master -U sa -P mypassword

and then:

alter login sa with default_database = master

Thanks
Laurentiu

|||I've googled this error message and I get a hundred hits. Shouldn't there be a KB? I have exactly the same problem. I changed the default DB, then dropped it. I have no idea what the sa password is. Do I need to uninstall/reinstall SS05?|||

I already posted an answer above. You just need to specify a different database to use at connection time, then change your default database to an existing one.

I'll check to see if we have a KB article on this and pass your feedback to write one if we don't already have it.

Thanks
Laurentiu

|||

I see now that you mentioned that you don't know sa's password.

sa was just provided as an example, for this operation you don't necessarily need to use sa to connect. You just need to connect with the login for which you've received this error. If you use Windows authentication, then you should connect like this:

sqlcmd -E -d master

then issue the ALTER LOGIN statement.

It's the "-d master" that's the key here - it specifies that the connection should be made to the master database, so the login won't try to connect to the database that no longer exists.

Hope this makes the solution clearer. If you still have problems with resetting the default database, let us know.

Thanks
Laurentiu

|||To me this seems like a bug with Sql Server Management Studio, as you can connect to the database by specifing the database under options. You cannot however change the user's default database as right click -> properties tries to make a new connection using the default database. As far as I can see, it should create the new connection with the same database specified in the options section?|||

You should post to SQL Server Tools General, for Management Studio issues. You can also search for existing bugs on this issue or open a new one at: http://lab.msdn.microsoft.com/productfeedback/.

Thanks
Laurentiu

|||

I got the same error with SQL Server Management Studio and could not resolve it with sa authentication because my config wouldn't let me log in as sa.

Selecting master as the connect database in the login dialog got me in. I then tried to edit my login object to change my default database, but this fails with the same error!

I then tried deleting my login. Failed again with error 4064.

Finally, I tried to right-click on the login object, and selected Script Login As > DROP to > New Query Editor Window, and then hit Execute in the view that appeared. It worked!

Hope this helps someone out there...

|||

I just ran into the same issue after I dropped a database that was mistakenly set to be the default database. I found the information posted here pointed me in the right direction, but it didn't really help much because I couldn't figure out which user should be modified when SQL Server 2005 is configured to use Windows authentication (e.g. trusted connections) exclusively. After a lot of digging through SQL Server Books Online, executing various stored procedures to dump login information, and experimentation, I finally stumbled on the right combination.

C:\> sqlcmd -E -d master

1> ALTER LOGIN [BUILTIN\Administrators] WITH DEFAULT_DATABASE=master

2> GO

I show the prompts above so you can see where to type the commands and the expected results (e.g. SQLCMD does not output any information or error messages).

|||

I detached a database on a network server with the idea of reattaching an updated version from my local db.

Evidently, the database I detached was the default database. I couldn't log in now because of the posts in this thread. I was able to log in using the Master db at the login dialog. However, I've tried everything in this post, and nothing seems to work!

When I try to execute a query against the master db (such as the sql in these posts), it executes fine. In the drop down list of available databases, the only thing it has is master... the rest says "server is not available". I'm able to ping it just fine.

I can't even restore the db I detached, because I get the same error msgs as not being able to log on. I desperately need to attach this database again with master as the default db.

How can I accomplish this? Can someone please help?

|||

The only thing I can do with logging in as master, is simply just to look at objects. I cannot perform any action at all against anything because of the same error message (Cannot open user default database. Login failed for user sa...).

How can I resolve this!!!!

Microsoft, please help..........

|||For what it's worth, the db icazon next to the server is simply a white circle (no activity, etc)....|||

I tried what you're mentioning Chris and it didn't work.

In the query window I have the following:

IFEXISTS(SELECT*FROMsys.server_principalsWHEREname= N'sa')

DROPLOGIN [sa]

The results state the following:

Msg 15405, Level 16, State 1, Line 3

Cannot use the special principal 'sa'.

Cannot Open User Default Database (error 4064)

Hi,

SQL Server 2005 installed on my computer. i was trying to make a login page with VS.2005 pro. But i got some errors on Website Administration Tool. Whatsoever, i registered a database (aspnetdb) . Then, i think i made my default database to aspnetdb. Something went wrong and i decided to delete aspnetdb and start whole procces from the begining and i did it. AAANDD WHOOOLA. I got this error:

Cannot Open User Default Database, Login Failed
Microsoft SQL Server, Error 4064

Is there anyway to change my default database to "master" again? Or simply will i uninstall all the sql server 2005?
(?f you say uninstall, answer this:: Will be any problem on VS 2005? I can't uninstall both :) )

You should determine what is the login you are connecting at, then login as administrator and issue an ALTER LOGIN statement to set the default database for that login to master. See Books Online for additional information on using the ALTER LOGIN statement.

Thanks
Laurentiu|||I don't think that Laurentiu understands the problem. I have run into the same situation, I am an administrator on the server, because the default database no longer exists (I had changed it from master) I can no longer connect. I would like to think that in the absence of my default database, it would revert to the master, but this is not the case. I'm unable to connect using the Administrator login to execute the ALTER LOGIN command.|||

You can resolve this by specifying another database you want to connect to; master, for example. Then you can reset the login's default database. With sqlcmd, you can do the following:

sqlcmd -d master -U sa -P mypassword

and then:

alter login sa with default_database = master

Thanks
Laurentiu

|||I've googled this error message and I get a hundred hits. Shouldn't there be a KB? I have exactly the same problem. I changed the default DB, then dropped it. I have no idea what the sa password is. Do I need to uninstall/reinstall SS05?|||

I already posted an answer above. You just need to specify a different database to use at connection time, then change your default database to an existing one.

I'll check to see if we have a KB article on this and pass your feedback to write one if we don't already have it.

Thanks
Laurentiu

|||

I see now that you mentioned that you don't know sa's password.

sa was just provided as an example, for this operation you don't necessarily need to use sa to connect. You just need to connect with the login for which you've received this error. If you use Windows authentication, then you should connect like this:

sqlcmd -E -d master

then issue the ALTER LOGIN statement.

It's the "-d master" that's the key here - it specifies that the connection should be made to the master database, so the login won't try to connect to the database that no longer exists.

Hope this makes the solution clearer. If you still have problems with resetting the default database, let us know.

Thanks
Laurentiu

|||To me this seems like a bug with Sql Server Management Studio, as you can connect to the database by specifing the database under options. You cannot however change the user's default database as right click -> properties tries to make a new connection using the default database. As far as I can see, it should create the new connection with the same database specified in the options section?|||

You should post to SQL Server Tools General, for Management Studio issues. You can also search for existing bugs on this issue or open a new one at: http://lab.msdn.microsoft.com/productfeedback/.

Thanks
Laurentiu

|||

I got the same error with SQL Server Management Studio and could not resolve it with sa authentication because my config wouldn't let me log in as sa.

Selecting master as the connect database in the login dialog got me in. I then tried to edit my login object to change my default database, but this fails with the same error!

I then tried deleting my login. Failed again with error 4064.

Finally, I tried to right-click on the login object, and selected Script Login As > DROP to > New Query Editor Window, and then hit Execute in the view that appeared. It worked!

Hope this helps someone out there...

|||

I just ran into the same issue after I dropped a database that was mistakenly set to be the default database. I found the information posted here pointed me in the right direction, but it didn't really help much because I couldn't figure out which user should be modified when SQL Server 2005 is configured to use Windows authentication (e.g. trusted connections) exclusively. After a lot of digging through SQL Server Books Online, executing various stored procedures to dump login information, and experimentation, I finally stumbled on the right combination.

C:\> sqlcmd -E -d master

1> ALTER LOGIN [BUILTIN\Administrators] WITH DEFAULT_DATABASE=master

2> GO

I show the prompts above so you can see where to type the commands and the expected results (e.g. SQLCMD does not output any information or error messages).

|||

I detached a database on a network server with the idea of reattaching an updated version from my local db.

Evidently, the database I detached was the default database. I couldn't log in now because of the posts in this thread. I was able to log in using the Master db at the login dialog. However, I've tried everything in this post, and nothing seems to work!

When I try to execute a query against the master db (such as the sql in these posts), it executes fine. In the drop down list of available databases, the only thing it has is master... the rest says "server is not available". I'm able to ping it just fine.

I can't even restore the db I detached, because I get the same error msgs as not being able to log on. I desperately need to attach this database again with master as the default db.

How can I accomplish this? Can someone please help?

|||

The only thing I can do with logging in as master, is simply just to look at objects. I cannot perform any action at all against anything because of the same error message (Cannot open user default database. Login failed for user sa...).

How can I resolve this!!!!

Microsoft, please help..........

|||For what it's worth, the db icazon next to the server is simply a white circle (no activity, etc)....|||

I tried what you're mentioning Chris and it didn't work.

In the query window I have the following:

IF EXISTS (SELECT * FROM sys.server_principals WHERE name = N'sa')

DROP LOGIN [sa]

The results state the following:

Msg 15405, Level 16, State 1, Line 3

Cannot use the special principal 'sa'.

Cannot Open User Default Database (error 4064)

Hi,

SQL Server 2005 installed on my computer. i was trying to make a login page with VS.2005 pro. But i got some errors on Website Administration Tool. Whatsoever, i registered a database (aspnetdb) . Then, i think i made my default database to aspnetdb. Something went wrong and i decided to delete aspnetdb and start whole procces from the begining and i did it. AAANDD WHOOOLA. I got this error:

Cannot Open User Default Database, Login Failed
Microsoft SQL Server, Error 4064

Is there anyway to change my default database to "master" again? Or simply will i uninstall all the sql server 2005?
(?f you say uninstall, answer this:: Will be any problem on VS 2005? I can't uninstall both :) )

You should determine what is the login you are connecting at, then login as administrator and issue an ALTER LOGIN statement to set the default database for that login to master. See Books Online for additional information on using the ALTER LOGIN statement.

Thanks
Laurentiu|||I don't think that Laurentiu understands the problem. I have run into the same situation, I am an administrator on the server, because the default database no longer exists (I had changed it from master) I can no longer connect. I would like to think that in the absence of my default database, it would revert to the master, but this is not the case. I'm unable to connect using the Administrator login to execute the ALTER LOGIN command.|||

You can resolve this by specifying another database you want to connect to; master, for example. Then you can reset the login's default database. With sqlcmd, you can do the following:

sqlcmd -d master -U sa -P mypassword

and then:

alter login sa with default_database = master

Thanks
Laurentiu

|||I've googled this error message and I get a hundred hits. Shouldn't there be a KB? I have exactly the same problem. I changed the default DB, then dropped it. I have no idea what the sa password is. Do I need to uninstall/reinstall SS05?|||

I already posted an answer above. You just need to specify a different database to use at connection time, then change your default database to an existing one.

I'll check to see if we have a KB article on this and pass your feedback to write one if we don't already have it.

Thanks
Laurentiu

|||

I see now that you mentioned that you don't know sa's password.

sa was just provided as an example, for this operation you don't necessarily need to use sa to connect. You just need to connect with the login for which you've received this error. If you use Windows authentication, then you should connect like this:

sqlcmd -E -d master

then issue the ALTER LOGIN statement.

It's the "-d master" that's the key here - it specifies that the connection should be made to the master database, so the login won't try to connect to the database that no longer exists.

Hope this makes the solution clearer. If you still have problems with resetting the default database, let us know.

Thanks
Laurentiu

|||To me this seems like a bug with Sql Server Management Studio, as you can connect to the database by specifing the database under options. You cannot however change the user's default database as right click -> properties tries to make a new connection using the default database. As far as I can see, it should create the new connection with the same database specified in the options section?|||

You should post to SQL Server Tools General, for Management Studio issues. You can also search for existing bugs on this issue or open a new one at: http://lab.msdn.microsoft.com/productfeedback/.

Thanks
Laurentiu

|||

I got the same error with SQL Server Management Studio and could not resolve it with sa authentication because my config wouldn't let me log in as sa.

Selecting master as the connect database in the login dialog got me in. I then tried to edit my login object to change my default database, but this fails with the same error!

I then tried deleting my login. Failed again with error 4064.

Finally, I tried to right-click on the login object, and selected Script Login As > DROP to > New Query Editor Window, and then hit Execute in the view that appeared. It worked!

Hope this helps someone out there...

|||

I just ran into the same issue after I dropped a database that was mistakenly set to be the default database. I found the information posted here pointed me in the right direction, but it didn't really help much because I couldn't figure out which user should be modified when SQL Server 2005 is configured to use Windows authentication (e.g. trusted connections) exclusively. After a lot of digging through SQL Server Books Online, executing various stored procedures to dump login information, and experimentation, I finally stumbled on the right combination.

C:\> sqlcmd -E -d master

1> ALTER LOGIN [BUILTIN\Administrators] WITH DEFAULT_DATABASE=master

2> GO

I show the prompts above so you can see where to type the commands and the expected results (e.g. SQLCMD does not output any information or error messages).

|||

I detached a database on a network server with the idea of reattaching an updated version from my local db.

Evidently, the database I detached was the default database. I couldn't log in now because of the posts in this thread. I was able to log in using the Master db at the login dialog. However, I've tried everything in this post, and nothing seems to work!

When I try to execute a query against the master db (such as the sql in these posts), it executes fine. In the drop down list of available databases, the only thing it has is master... the rest says "server is not available". I'm able to ping it just fine.

I can't even restore the db I detached, because I get the same error msgs as not being able to log on. I desperately need to attach this database again with master as the default db.

How can I accomplish this? Can someone please help?

|||

The only thing I can do with logging in as master, is simply just to look at objects. I cannot perform any action at all against anything because of the same error message (Cannot open user default database. Login failed for user sa...).

How can I resolve this!!!!

Microsoft, please help..........

|||For what it's worth, the db icazon next to the server is simply a white circle (no activity, etc)....|||

I tried what you're mentioning Chris and it didn't work.

In the query window I have the following:

IF EXISTS (SELECT * FROM sys.server_principals WHERE name = N'sa')

DROP LOGIN [sa]

The results state the following:

Msg 15405, Level 16, State 1, Line 3

Cannot use the special principal 'sa'.

Cannot Open User Default Database (error 4064)

Hi,

SQL Server 2005 installed on my computer. i was trying to make a login page with VS.2005 pro. But i got some errors on Website Administration Tool. Whatsoever, i registered a database (aspnetdb) . Then, i think i made my default database to aspnetdb. Something went wrong and i decided to delete aspnetdb and start whole procces from the begining and i did it. AAANDD WHOOOLA. I got this error:

Cannot Open User Default Database, Login Failed
Microsoft SQL Server, Error 4064

Is there anyway to change my default database to "master" again? Or simply will i uninstall all the sql server 2005?
(?f you say uninstall, answer this:: Will be any problem on VS 2005? I can't uninstall both :) )

You should determine what is the login you are connecting at, then login as administrator and issue an ALTER LOGIN statement to set the default database for that login to master. See Books Online for additional information on using the ALTER LOGIN statement.

Thanks
Laurentiu|||I don't think that Laurentiu understands the problem. I have run into the same situation, I am an administrator on the server, because the default database no longer exists (I had changed it from master) I can no longer connect. I would like to think that in the absence of my default database, it would revert to the master, but this is not the case. I'm unable to connect using the Administrator login to execute the ALTER LOGIN command.|||

You can resolve this by specifying another database you want to connect to; master, for example. Then you can reset the login's default database. With sqlcmd, you can do the following:

sqlcmd -d master -U sa -P mypassword

and then:

alter login sa with default_database = master

Thanks
Laurentiu

|||I've googled this error message and I get a hundred hits. Shouldn't there be a KB? I have exactly the same problem. I changed the default DB, then dropped it. I have no idea what the sa password is. Do I need to uninstall/reinstall SS05?|||

I already posted an answer above. You just need to specify a different database to use at connection time, then change your default database to an existing one.

I'll check to see if we have a KB article on this and pass your feedback to write one if we don't already have it.

Thanks
Laurentiu

|||

I see now that you mentioned that you don't know sa's password.

sa was just provided as an example, for this operation you don't necessarily need to use sa to connect. You just need to connect with the login for which you've received this error. If you use Windows authentication, then you should connect like this:

sqlcmd -E -d master

then issue the ALTER LOGIN statement.

It's the "-d master" that's the key here - it specifies that the connection should be made to the master database, so the login won't try to connect to the database that no longer exists.

Hope this makes the solution clearer. If you still have problems with resetting the default database, let us know.

Thanks
Laurentiu

|||To me this seems like a bug with Sql Server Management Studio, as you can connect to the database by specifing the database under options. You cannot however change the user's default database as right click -> properties tries to make a new connection using the default database. As far as I can see, it should create the new connection with the same database specified in the options section?|||

You should post to SQL Server Tools General, for Management Studio issues. You can also search for existing bugs on this issue or open a new one at: http://lab.msdn.microsoft.com/productfeedback/.

Thanks
Laurentiu

|||

I got the same error with SQL Server Management Studio and could not resolve it with sa authentication because my config wouldn't let me log in as sa.

Selecting master as the connect database in the login dialog got me in. I then tried to edit my login object to change my default database, but this fails with the same error!

I then tried deleting my login. Failed again with error 4064.

Finally, I tried to right-click on the login object, and selected Script Login As > DROP to > New Query Editor Window, and then hit Execute in the view that appeared. It worked!

Hope this helps someone out there...

|||

I just ran into the same issue after I dropped a database that was mistakenly set to be the default database. I found the information posted here pointed me in the right direction, but it didn't really help much because I couldn't figure out which user should be modified when SQL Server 2005 is configured to use Windows authentication (e.g. trusted connections) exclusively. After a lot of digging through SQL Server Books Online, executing various stored procedures to dump login information, and experimentation, I finally stumbled on the right combination.

C:\> sqlcmd -E -d master

1> ALTER LOGIN [BUILTIN\Administrators] WITH DEFAULT_DATABASE=master

2> GO

I show the prompts above so you can see where to type the commands and the expected results (e.g. SQLCMD does not output any information or error messages).

|||

I detached a database on a network server with the idea of reattaching an updated version from my local db.

Evidently, the database I detached was the default database. I couldn't log in now because of the posts in this thread. I was able to log in using the Master db at the login dialog. However, I've tried everything in this post, and nothing seems to work!

When I try to execute a query against the master db (such as the sql in these posts), it executes fine. In the drop down list of available databases, the only thing it has is master... the rest says "server is not available". I'm able to ping it just fine.

I can't even restore the db I detached, because I get the same error msgs as not being able to log on. I desperately need to attach this database again with master as the default db.

How can I accomplish this? Can someone please help?

|||

The only thing I can do with logging in as master, is simply just to look at objects. I cannot perform any action at all against anything because of the same error message (Cannot open user default database. Login failed for user sa...).

How can I resolve this!!!!

Microsoft, please help..........

|||For what it's worth, the db icazon next to the server is simply a white circle (no activity, etc)....|||

I tried what you're mentioning Chris and it didn't work.

In the query window I have the following:

IF EXISTS (SELECT * FROM sys.server_principals WHERE name = N'sa')

DROP LOGIN [sa]

The results state the following:

Msg 15405, Level 16, State 1, Line 3

Cannot use the special principal 'sa'.

Cannot Open User Default Database (error 4064)

Hi,

SQL Server 2005 installed on my computer. i was trying to make a login page with VS.2005 pro. But i got some errors on Website Administration Tool. Whatsoever, i registered a database (aspnetdb) . Then, i think i made my default database to aspnetdb. Something went wrong and i decided to delete aspnetdb and start whole procces from the begining and i did it. AAANDD WHOOOLA. I got this error:

Cannot Open User Default Database, Login Failed
Microsoft SQL Server, Error 4064

Is there anyway to change my default database to "master" again? Or simply will i uninstall all the sql server 2005?
(?f you say uninstall, answer this:: Will be any problem on VS 2005? I can't uninstall both :) )

You should determine what is the login you are connecting at, then login as administrator and issue an ALTER LOGIN statement to set the default database for that login to master. See Books Online for additional information on using the ALTER LOGIN statement.

Thanks
Laurentiu|||I don't think that Laurentiu understands the problem. I have run into the same situation, I am an administrator on the server, because the default database no longer exists (I had changed it from master) I can no longer connect. I would like to think that in the absence of my default database, it would revert to the master, but this is not the case. I'm unable to connect using the Administrator login to execute the ALTER LOGIN command.|||

You can resolve this by specifying another database you want to connect to; master, for example. Then you can reset the login's default database. With sqlcmd, you can do the following:

sqlcmd -d master -U sa -P mypassword

and then:

alter login sa with default_database = master

Thanks
Laurentiu

|||I've googled this error message and I get a hundred hits. Shouldn't there be a KB? I have exactly the same problem. I changed the default DB, then dropped it. I have no idea what the sa password is. Do I need to uninstall/reinstall SS05?|||

I already posted an answer above. You just need to specify a different database to use at connection time, then change your default database to an existing one.

I'll check to see if we have a KB article on this and pass your feedback to write one if we don't already have it.

Thanks
Laurentiu

|||

I see now that you mentioned that you don't know sa's password.

sa was just provided as an example, for this operation you don't necessarily need to use sa to connect. You just need to connect with the login for which you've received this error. If you use Windows authentication, then you should connect like this:

sqlcmd -E -d master

then issue the ALTER LOGIN statement.

It's the "-d master" that's the key here - it specifies that the connection should be made to the master database, so the login won't try to connect to the database that no longer exists.

Hope this makes the solution clearer. If you still have problems with resetting the default database, let us know.

Thanks
Laurentiu

|||To me this seems like a bug with Sql Server Management Studio, as you can connect to the database by specifing the database under options. You cannot however change the user's default database as right click -> properties tries to make a new connection using the default database. As far as I can see, it should create the new connection with the same database specified in the options section?|||

You should post to SQL Server Tools General, for Management Studio issues. You can also search for existing bugs on this issue or open a new one at: http://lab.msdn.microsoft.com/productfeedback/.

Thanks
Laurentiu

|||

I got the same error with SQL Server Management Studio and could not resolve it with sa authentication because my config wouldn't let me log in as sa.

Selecting master as the connect database in the login dialog got me in. I then tried to edit my login object to change my default database, but this fails with the same error!

I then tried deleting my login. Failed again with error 4064.

Finally, I tried to right-click on the login object, and selected Script Login As > DROP to > New Query Editor Window, and then hit Execute in the view that appeared. It worked!

Hope this helps someone out there...

|||

I just ran into the same issue after I dropped a database that was mistakenly set to be the default database. I found the information posted here pointed me in the right direction, but it didn't really help much because I couldn't figure out which user should be modified when SQL Server 2005 is configured to use Windows authentication (e.g. trusted connections) exclusively. After a lot of digging through SQL Server Books Online, executing various stored procedures to dump login information, and experimentation, I finally stumbled on the right combination.

C:\> sqlcmd -E -d master

1> ALTER LOGIN [BUILTIN\Administrators] WITH DEFAULT_DATABASE=master

2> GO

I show the prompts above so you can see where to type the commands and the expected results (e.g. SQLCMD does not output any information or error messages).

|||

I detached a database on a network server with the idea of reattaching an updated version from my local db.

Evidently, the database I detached was the default database. I couldn't log in now because of the posts in this thread. I was able to log in using the Master db at the login dialog. However, I've tried everything in this post, and nothing seems to work!

When I try to execute a query against the master db (such as the sql in these posts), it executes fine. In the drop down list of available databases, the only thing it has is master... the rest says "server is not available". I'm able to ping it just fine.

I can't even restore the db I detached, because I get the same error msgs as not being able to log on. I desperately need to attach this database again with master as the default db.

How can I accomplish this? Can someone please help?

|||

The only thing I can do with logging in as master, is simply just to look at objects. I cannot perform any action at all against anything because of the same error message (Cannot open user default database. Login failed for user sa...).

How can I resolve this!!!!

Microsoft, please help..........

|||For what it's worth, the db icazon next to the server is simply a white circle (no activity, etc)....|||

I tried what you're mentioning Chris and it didn't work.

In the query window I have the following:

IF EXISTS (SELECT * FROM sys.server_principals WHERE name = N'sa')

DROP LOGIN [sa]

The results state the following:

Msg 15405, Level 16, State 1, Line 3

Cannot use the special principal 'sa'.

sql

Thursday, March 8, 2012

Cannot link measure group from cube in different AS database

I am trying to link a measure group from a cube in a different AS database (but on the same server), and get the following error: Errors in the OLAP storage engine: The metadata for the statically linked measure group, with the name of 'AD043', cannot be verified against the source object.

Note that I can successfully link a dimension from a cube in a different AS database, and can also link a measure group from a different cube in the same AS database.

I found the following information at MSDN, but am not sure if this is the proper solution (nor do I entirely understand it--I'm not the security guy in our organization): In order to define or use a linked measure group, the Windows service account for the Analysis Services instance must belong to an Analysis Services database role that has ReadDefinition and Read access rights on the source Analysis Services instance to the source cube and measure group, or must belong to the Analysis Services Administrators role for the source Analysis Services instance.

At: http://msdn2.microsoft.com/en-us/library/ms174899(SQL.90).aspx

Can someone help me, please ?

When you create a linked MeasureGroup on a AS2005 server A, you specify its Source as a MeasureGroupBinding with these important properties:

- the DataSourceID pointing to the DataSource whose connection string points to the AS2005 server B on which the source MeasureGroup is

- the Persistance: an enum value, NotPersisted or Metadata; NonPersisted is the default and it means that the linked MeasureGroup content from server A will be pulled from the source server B at the time of creation. So a connection from server A is opened to server B. That's why the account for the AS2005 service on machine A needs to have permissions to AS2005 on machine B to read the source MeasureGroup. If the Persistance however is specified as Metadata, it means that you are sending manually the content of the linked MeasureGroup (so you specified the linked Measures one by one). In this case, a connection from A to B is still opened to verify the consistency between the linked MeasureGroup and its source. This verification adds more rules (that would generate the same error you are getting): the linked Measures need to be defined in same order as in the source MeasureGroup and they need to have the same DataTypes and AggregationFunctions as their source Measures.

Adrian Dumitrascu.

|||

Thanks, Adrian. I read your response carefully, and also passed it on to our database admin. As you stated, "a connection from A to B is still opened to verify the consistency between the linked MeasureGroup and its source. This verification adds more rules (that would generate the same error you are getting): the linked Measures need to be defined in same order as in the source MeasureGroup and they need to have the same DataTypes and AggregationFunctions as their source Measures."

I found thru experimentation last night that these "rules" you mention prevent me from deleting any of the measures in a linked measure group--and this appears to cause of the problem. This seems like bizarre behavior, but I can live with it merely by setting the visible properties for those linked measures I do not want displayed to false.

Thanks again.

|||

Yes, the linked MeasureGroup needs to define the same list of Measures as the source (in the same order) and the Visible property is the way to hide them fro user.

Adrian Dumitrascu.

Cannot kill process with EC wait type

Hi
I had tired to create index on large databse (>200GB, engine ss2k) but
I got errors, so I executed DBCC CHECKDB. DBCC told me that I have to
execute it with repair options. But I noticed in Activity Monitor that
I had still running creating index process with EC wait type. Then I
started to kill it but without success.
Is it possible to kill such process, without restarting sql server?
Best regards,
BartekHi Bartek
The process may be rolling back try KILL WITH STATUSONLY to see what it is
doing.
John
"Bartolo" wrote:
> Hi
> I had tired to create index on large databse (>200GB, engine ss2k) but
> I got errors, so I executed DBCC CHECKDB. DBCC told me that I have to
> execute it with repair options. But I noticed in Activity Monitor that
> I had still running creating index process with EC wait type. Then I
> started to kill it but without success.
> Is it possible to kill such process, without restarting sql server?
> Best regards,
> Bartek
>|||Hi John
Thanks for reponse. I tried this one, it stuck to 100% for few days.
I got reply on another forums that I can't even kill this process with
server restart.
It is really confusing that there is no way to get rid off such
process.
Bartek
On 16 Mar, 08:22, John Bell <jbellnewspo...@.hotmail.com> wrote:
> Hi Bartek
> The process may be rolling back try KILL WITH STATUSONLY to see what it is
> doing.
> John
> "Bartolo" wrote:
> > Hi
> > I had tired to create index on large databse (>200GB, engine ss2k) but
> > I got errors, so I executed DBCC CHECKDB. DBCC told me that I have to
> > execute it with repair options. But I noticed in Activity Monitor that
> > I had still running creating index process with EC wait type. Then I
> > started to kill it but without success.
> > Is it possible to kill such process, without restarting sql server?
> > Best regards,
> > Bartek|||I succeeded.
It seems that restarting SQL Server is the only opition to get rid of
such process.
Cheers,
Bartek
On 17 Mar, 12:51, Bartolo <andrew...@.gmail.com> wrote:
> Hi John
> Thanks for reponse. I tried this one, it stuck to 100% for few days.
> I got reply on another forums that I can't even kill this process with
> server restart.
> It is really confusing that there is no way to get rid off such
> process.
> Bartek
> On 16 Mar, 08:22, John Bell <jbellnewspo...@.hotmail.com> wrote:
> > Hi Bartek
> > The process may be rolling back try KILL WITH STATUSONLY to see what it is
> > doing.
> > John
> > "Bartolo" wrote:
> > > Hi
> > > I had tired to create index on large databse (>200GB, engine ss2k) but
> > > I got errors, so I executed DBCC CHECKDB. DBCC told me that I have to
> > > execute it with repair options. But I noticed in Activity Monitor that
> > > I had still running creating index process with EC wait type. Then I
> > > started to kill it but without success.
> > > Is it possible to kill such process, without restarting sql server?
> > > Best regards,
> > > Bartek

Wednesday, March 7, 2012

cannot install SQL Server Express, keep getting errors

I am trying to install SQL Server 2005 Express, but it fails.
SQL Server Setup has detected incompatible components from Beta version of Visual Studio, .NETFramework or SQL Server 2005. Use Add or Remove to

I had earlier installed Beta 2 Version of Dev Studio 2005 and SQL Server 2005 Beta 2. I also had DevStudio 2003 and SQL Server installed. I have gone through and un-installed everything, but I keep getting this error.

I have also tried
msiexec /x {2AFFFDD7-ED85-4A90-8C52-5DA9EBDC9B8F}
msiexec /x {2750B389-A2D2-4953-99CA-27C1F2A8E6FD}
Both of these un-install start, but fail with error messages.

Would appreciate if anyone can help.

Saleem Yusuf
Saleem_Yusuf@.hotmail.com

Try the following.
1. Uninstall all visible Beta components in Add/Remove Programes.

2. Detect the Beta components infromation in the the log file located in %Program Files%\Microsoft SQL Server\90\Setup Bootstrap\LOG\Files\SQLSetupNo_%machinename%_Core(Local).log.

3. Search the whole registry keys, remove those registy keys related to those Beta components. This is time-consuming.

4. Kill all Beta SQL Services (including SQL, OLAP, RS, SQLBROWSER, SQLAGENT, etc.) if they are existing with command sc.

5. Reboot the machine.

6. Start Setup again.

|||I looked at the log and tried to uninstall old version, but it does not exists.
However, in the logs, I saw a version number and seach registry. They are many entries of SQL Server Express. I deleted some of them, but no luck yet. I am quite sure if I get rid of all the old registry setting, it should fix the problem.
Thanks for your help,

Saleem|||Problem fixed. I can now install SQL Server Express. Thanks for you help.
This is what I did.
Looked in file \Program Files\Microsoft SQL Server\90\Setup Bootstrap\LOG.
It had referecne to other log files. I opened one of the files, HostName_core.log
(notepad C:\Program Files\Microsoft SQL Server\90\Setup Bootstrap\LOG\Files\SQLSetup0012_<My_HostName>_Core.log)

This file had multiple reference to older versions of SQL Server Express. Example
Product "{2AFFFDD7-ED85-4A90-8C52-5DA9EBDC9B8F}" versioned 9.00.1116 is not compatible with current builds of SQL Server.Expected at least version: 9.00.1399.06
The Product Name is "Microsoft SQL Server 2005 Express Edition CTP"

First I tried to uninstall, (MsiExec.exe /x {2AFFFDD7-ED85-4A90-8C52-5DA9EBDC9B8F}). Un-install failed.

Then I searched for 9.00.1399.06. I found multiple entried. I deleted them all.
After that I was able install SQL Server Express.|||

I tried 3 other fixes on other forums (asp.net,etc.) and this is the only one that worked.

My log file had a similar message. However, I deleted the entries related to the older version (in the case above, that would be 9.00.1116); not the later or "expected at least" version (9.00.1399.06).

With this fix, I did not have to remove .net 1.0 beta or .net 1.1

|||Thanks for posting - that worked for me too - I had just spent my own money buying VS2005 Pro and couldn't install SQL Express because previously installed beta stuff was fouling up the install.

Perhaps the SQL guys at MS could revise the install script in future releases to 'clean up' before installing... Just a suggestion.

Anyway, just re-installed trhe whole .Net DVD and it's running now, so thanks!

Mark

cannot install SQL Server Express, keep getting errors

I am trying to install SQL Server 2005 Express, but it fails.
SQL Server Setup has detected incompatible components from Beta version of Visual Studio, .NETFramework or SQL Server 2005. Use Add or Remove to

I had earlier installed Beta 2 Version of Dev Studio 2005 and SQL Server 2005 Beta 2. I also had DevStudio 2003 and SQL Server installed. I have gone through and un-installed everything, but I keep getting this error.

I have also tried
msiexec /x {2AFFFDD7-ED85-4A90-8C52-5DA9EBDC9B8F}
msiexec /x {2750B389-A2D2-4953-99CA-27C1F2A8E6FD}
Both of these un-install start, but fail with error messages.

Would appreciate if anyone can help.

Saleem Yusuf
Saleem_Yusuf@.hotmail.com

Try the following.
1. Uninstall all visible Beta components in Add/Remove Programes.

2. Detect the Beta components infromation in the the log file located in %Program Files%\Microsoft SQL Server\90\Setup Bootstrap\LOG\Files\SQLSetupNo_%machinename%_Core(Local).log.

3. Search the whole registry keys, remove those registy keys related to those Beta components. This is time-consuming.

4. Kill all Beta SQL Services (including SQL, OLAP, RS, SQLBROWSER, SQLAGENT, etc.) if they are existing with command sc.

5. Reboot the machine.

6. Start Setup again.

|||I looked at the log and tried to uninstall old version, but it does not exists.
However, in the logs, I saw a version number and seach registry. They are many entries of SQL Server Express. I deleted some of them, but no luck yet. I am quite sure if I get rid of all the old registry setting, it should fix the problem.
Thanks for your help,

Saleem|||Problem fixed. I can now install SQL Server Express. Thanks for you help.
This is what I did.
Looked in file \Program Files\Microsoft SQL Server\90\Setup Bootstrap\LOG.
It had referecne to other log files. I opened one of the files, HostName_core.log
(notepad C:\Program Files\Microsoft SQL Server\90\Setup Bootstrap\LOG\Files\SQLSetup0012_<My_HostName>_Core.log)

This file had multiple reference to older versions of SQL Server Express. Example
Product "{2AFFFDD7-ED85-4A90-8C52-5DA9EBDC9B8F}" versioned 9.00.1116 is not compatible with current builds of SQL Server.Expected at least version: 9.00.1399.06
The Product Name is "Microsoft SQL Server 2005 Express Edition CTP"

First I tried to uninstall, (MsiExec.exe /x {2AFFFDD7-ED85-4A90-8C52-5DA9EBDC9B8F}). Un-install failed.

Then I searched for 9.00.1399.06. I found multiple entried. I deleted them all.
After that I was able install SQL Server Express.|||

I tried 3 other fixes on other forums (asp.net,etc.) and this is the only one that worked.

My log file had a similar message. However, I deleted the entries related to the older version (in the case above, that would be 9.00.1116); not the later or "expected at least" version (9.00.1399.06).

With this fix, I did not have to remove .net 1.0 beta or .net 1.1

|||Thanks for posting - that worked for me too - I had just spent my own money buying VS2005 Pro and couldn't install SQL Express because previously installed beta stuff was fouling up the install.

Perhaps the SQL guys at MS could revise the install script in future releases to 'clean up' before installing... Just a suggestion.

Anyway, just re-installed trhe whole .Net DVD and it's running now, so thanks!

Mark

cannot install SQL Server Express, keep getting errors

I am trying to install SQL Server 2005 Express, but it fails.
SQL Server Setup has detected incompatible components from Beta version of Visual Studio, .NETFramework or SQL Server 2005. Use Add or Remove to

I had earlier installed Beta 2 Version of Dev Studio 2005 and SQL Server 2005 Beta 2. I also had DevStudio 2003 and SQL Server installed. I have gone through and un-installed everything, but I keep getting this error.

I have also tried
msiexec /x {2AFFFDD7-ED85-4A90-8C52-5DA9EBDC9B8F}
msiexec /x {2750B389-A2D2-4953-99CA-27C1F2A8E6FD}
Both of these un-install start, but fail with error messages.

Would appreciate if anyone can help.

Saleem Yusuf
Saleem_Yusuf@.hotmail.com

Try the following.
1. Uninstall all visible Beta components in Add/Remove Programes.

2. Detect the Beta components infromation in the the log file located in %Program Files%\Microsoft SQL Server\90\Setup Bootstrap\LOG\Files\SQLSetupNo_%machinename%_Core(Local).log.

3. Search the whole registry keys, remove those registy keys related to those Beta components. This is time-consuming.

4. Kill all Beta SQL Services (including SQL, OLAP, RS, SQLBROWSER, SQLAGENT, etc.) if they are existing with command sc.

5. Reboot the machine.

6. Start Setup again.|||I looked at the log and tried to uninstall old version, but it does not exists.
However, in the logs, I saw a version number and seach registry. They are many entries of SQL Server Express. I deleted some of them, but no luck yet. I am quite sure if I get rid of all the old registry setting, it should fix the problem.
Thanks for your help,

Saleem|||Problem fixed. I can now install SQL Server Express. Thanks for you help.
This is what I did.
Looked in file \Program Files\Microsoft SQL Server\90\Setup Bootstrap\LOG.
It had referecne to other log files. I opened one of the files, HostName_core.log
(notepad C:\Program Files\Microsoft SQL Server\90\Setup Bootstrap\LOG\Files\SQLSetup0012_<My_HostName>_Core.log)

This file had multiple reference to older versions of SQL Server Express. Example
Product "{2AFFFDD7-ED85-4A90-8C52-5DA9EBDC9B8F}" versioned 9.00.1116 is not compatible with current builds of SQL Server.Expected at least version: 9.00.1399.06
The Product Name is "Microsoft SQL Server 2005 Express Edition CTP"

First I tried to uninstall, (MsiExec.exe /x {2AFFFDD7-ED85-4A90-8C52-5DA9EBDC9B8F}). Un-install failed.

Then I searched for 9.00.1399.06. I found multiple entried. I deleted them all.
After that I was able install SQL Server Express.
|||

I tried 3 other fixes on other forums (asp.net,etc.) and this is the only one that worked.

My log file had a similar message. However, I deleted the entries related to the older version (in the case above, that would be 9.00.1116); not the later or "expected at least" version (9.00.1399.06).

With this fix, I did not have to remove .net 1.0 beta or .net 1.1

|||Thanks for posting - that worked for me too - I had just spent my own money buying VS2005 Pro and couldn't install SQL Express because previously installed beta stuff was fouling up the install.

Perhaps the SQL guys at MS could revise the install script in future releases to 'clean up' before installing... Just a suggestion.

Anyway, just re-installed trhe whole .Net DVD and it's running now, so thanks!

Mark

Friday, February 24, 2012

Cannot INSERT INTO SQL database.

I'm not sure what the problem is. I am not getting any errors, but I can't get this code to insert into my SQL db. I've checked the permissions on the database and table, and it looks fine.

Is there something wrong with this code? I'm trying to switch from VB to C#, so it's still new to me. I've used the connection string in another APP so I know it works.

If I'm not getting an asp.net error, does that point to a problem with the DB? Thanks.

protected

void Button1_Click(object sender,EventArgs e)

{

SqlConnection Conn;
SqlCommand Command;

Conn =

newSqlConnection();
Conn.ConnectionString =ConfigurationManager.AppSettings["ConnectionString"];
Command =newSqlCommand();

Command.CommandText =

"INSERT INTO [tbl_Test] ([test_name], [test_email]) VALUES (@.test_name, @.test_email)";

Command.CommandType =

CommandType.Text;
Command.Connection = Conn;
Command.Parameters.Add("test_name", tbName.Text);
Command.Parameters.Add("test_email", tbEmail.Text);try

{

Command.Connection.Open();
Command.ExecuteNonQuery();

}

catch (Exception ex)

{

lError.Text = ex.Message;

}

finally

{

Command.Connection.Close();
pSubscribe.Visible =

false;
lThanks.Visible =true;

}

Command.Parameters.Add("test_name", tbName.Text);
Command.Parameters.Add("test_email", tbEmail.Text);

should be

Command.Parameters.Add("@.test_name", tbName.Text);
Command.Parameters.Add("@.test_email", tbEmail.Text);

|||Thanks for the reply. I changed the parameters, but it still doesn't work. Any thing else I can try?|||I got it. In my SQL table, I didn't have the "identity = yes" checkbox selected for my primary key. Thanks for your help!

Sunday, February 12, 2012

Cannot find column errors

Greetings!

I have a project that has been in production for a couple years now. It's a v1.1 ASP.NET web farm hitting a SQL database. The last couple weeks, the website has been erroring out on various pages for about 1-2 hours at a time twice a week. While the error messages are occurring, I cannot reproduce the errors myself.


Here are some of the error messages I recieve:

Cannot find column [ColumnName][ColumnName]is neither a DataColumn nor a DataRelation for table RESULT.[ColumnName] (Thisis a wierd one. The error message returned is just a column name)No record foundColumn '[ColumnName]' does not belong to table RESULT.

I come to a dead end when I follow the Stack Trace to find a programmatic error. I'm able to hit the same page with all the same form fields at the error occured on and I cannot reproduce.

The only consistentcy in these errors is that they come all at once and they are database related.

Anyone have an issue like this before?

Are you saying you can't replicate the problem "later" or on the same webserver at the same time as other users are having the problem?

|||

I cannot replicate the problem at either time.

I have the error messages emailed to me as they occur with information about the error and a link with URL parameters to the page. During the last incident, I was hitting pages where the error just occured moments before.


Any help is greatly appreciated... even if it's another question.

josh

|||

You must use column name from the ASP.net, not from Database.

For example, in my database, the column is [Closed Num]. But asp.net create the name [Closed_Num] for me. When you use filter expression, use [Close_Num] no problem. If you use the column name in the database, you will get the similar error!

Hope it is helpful.

MSVSBoy