Monday, March 19, 2012
Could not locate file 'data01_log' in sysfiles
getting the above error. Any advice is greatly appreciated.
sp_helpdb output:
DATA01
1 e:\mssql\data\data01.mdf
PRIMARY 4102976 KB Unlimited 10% data only
DATA01_log
2 c:\logfiles\data01_log.ldf
NULL 327296 KB 460800 KB 10% log only
When I run shrinkfile I get this:
dbcc shrinkfile (data01_log,320)
Server: Msg 8985, Level 16, State 1, Line 1
Could not locate file 'data01_log' in sysfiles.
DBCC execution completed. If DBCC printed error messages, contact your
system administrator.Hi
If you do a SELECT * from sysfiles , what is the NAME returned ?
Are you then using the exact - case sensitive spelling?
Jack Vamvas
__________________________________________________________________
Receive free SQL tips - register at www.ciquery.com/sqlserver.htm
SQL Server Performance Audit - check www.ciquery.com/sqlserver_audit.htm
New article by Jack Vamvas - SQL and Markov Chains -
www.ciquery.com/articles/art_04.asp
"Rick Billingsley" <RickBillingsley@.discussions.microsoft.com> wrote in
message news:35983A24-DD51-43EA-A644-BA857A76F29B@.microsoft.com...
> I need to shrink this log file, and setup some maintenance tasks, but I am
> getting the above error. Any advice is greatly appreciated.
> sp_helpdb output:
> DATA01
> 1 e:\mssql\data\data01.mdf
>
> PRIMARY 4102976 KB Unlimited 10% data only
> DATA01_log
> 2
c:\logfiles\data01_log.ldf
>
> NULL 327296 KB 460800 KB 10% log only
> When I run shrinkfile I get this:
> dbcc shrinkfile (data01_log,320)
> Server: Msg 8985, Level 16, State 1, Line 1
> Could not locate file 'data01_log' in sysfiles.
> DBCC execution completed. If DBCC printed error messages, contact your
> system administrator.
>|||the select query returns the mastlog. This is not the log I am trying to
shrink/backup.
I believe the problem is that the log I want is on a different logical drive
(c vs. e) than the database.
I have tried running the shrinkfile with the exact case-sensitive spelling
with the same results.|||Change your database context to Data01. The select statement
indicates that you are trying to do this from the master
database. Shrinkfile applies to files in the current
database so you need to be in the appropriate database.
-Sue
On Mon, 23 Jan 2006 08:58:03 -0800, "Rick Billingsley"
<RickBillingsley@.discussions.microsoft.com> wrote:
>the select query returns the mastlog. This is not the log I am trying to
>shrink/backup.
>I believe the problem is that the log I want is on a different logical drive
>(c vs. e) than the database.
>I have tried running the shrinkfile with the exact case-sensitive spelling
>with the same results.
Could not locate entry in sysdatabases for database 'MYSQL
I am trying to run a stored procedure on a linked MySQL server
i can select from the MySQL server, so i know that there is a valid
link
i can run the stored procedure on the MySQL server using the command
call triodent.UpdateDownloadTable
but when i try to execute
exec MYSQL.triodent.UpdateDownloadTable
i get the "could not locate..." error
is it because MySQL is using call rather than exec? if so doesn't
anyone have an idea for the syntax?
many Thanks
Ian
Try
exec MYSQL.triodent..UpdateDownloadTable
Jason Massie
www: http://statisticsio.com
rss: http://feeds.feedburner.com/statisticsio
<ian.tiesdell@.hotmail.co.uk> wrote in message
news:9f6c966a-b884-4efe-b037-2b339fb5d236@.q1g2000prf.googlegroups.com...
> Hi
> I am trying to run a stored procedure on a linked MySQL server
> i can select from the MySQL server, so i know that there is a valid
> link
> i can run the stored procedure on the MySQL server using the command
> call triodent.UpdateDownloadTable
> but when i try to execute
> exec MYSQL.triodent.UpdateDownloadTable
> i get the "could not locate..." error
> is it because MySQL is using call rather than exec? if so doesn't
> anyone have an idea for the syntax?
> many Thanks
> Ian
|||thanks jason but i get
Msg 7212, Level 17, State 1, Line 3
Could not execute procedure 'UpdateDownloadTable' on remote server
'MYSQL'.
:-(
|||That's progress. It sounds like it is permissions now. Verify the linked
server user has the rights to execute on MySQL.
Jason Massie
www: http://statisticsio.com
rss: http://feeds.feedburner.com/statisticsio
<ian.tiesdell@.hotmail.co.uk> wrote in message
news:f098afcc-03ba-4977-9698-f38b83f34499@.b9g2000prh.googlegroups.com...
> thanks jason but i get
> Msg 7212, Level 17, State 1, Line 3
> Could not execute procedure 'UpdateDownloadTable' on remote server
> 'MYSQL'.
> :-(
|||jason wrote:
> That's progress. It sounds like it is permissions now. Verify the linked
> server user has the rights to execute on MySQL.
>
Also check the properties for the linked server and verify RPC is turned on.
|||sorry to be dim but how do i check this?
i've looked at server objects/linked servers security settings and i
have
connections will be made using this security context
remote login root
with password and then the password
RPC is turned on
Data Access is True
Ian
|||ian.tiesdell@.hotmail.co.uk wrote:
> sorry to be dim but how do i check this?
> i've looked at server objects/linked servers security settings and i
> have
> connections will be made using this security context
> remote login root
> with password and then the password
> RPC is turned on
> Data Access is True
> Ian
Well, if you looked at the linked server properties and saw the RPC is
enabled (there are two options), then that is all you need to do.
Jeff
|||so if the security settings are Ok and the syntax is OK?
what else could be wrong?
using
exec MYSQL.triodent..UpdateDownloadTable
Msg 7212, Level 17, State 1, Line 1
Could not execute procedure 'UpdateDownloadTable' on remote server
'MYSQL'
|||ian.tiesdell@.hotmail.co.uk wrote:
> so if the security settings are Ok and the syntax is OK?
> what else could be wrong?
> using
> exec MYSQL.triodent..UpdateDownloadTable
> Msg 7212, Level 17, State 1, Line 1
> Could not execute procedure 'UpdateDownloadTable' on remote server
> 'MYSQL'
Only thing I can think of is maybe permission issues in 'MYSQL'? I
don't know 'MYSQL' - so I really can't help with that side.
|||I think it could be mySQL causing the problem - what i've done is to
mimic the actions of the stored proc using update statements from
MSSQL over to the linked server
thanks for your input
Ian
Could not locate entry in sysdatabases for database 'MYSQL
I am trying to run a stored procedure on a linked MySQL server
i can select from the MySQL server, so i know that there is a valid
link
i can run the stored procedure on the MySQL server using the command
call triodent.UpdateDownloadTable
but when i try to execute
exec MYSQL.triodent.UpdateDownloadTable
i get the "could not locate..." error
is it because MySQL is using call rather than exec? if so doesn't
anyone have an idea for the syntax?
many Thanks
IanTry
exec MYSQL.triodent..UpdateDownloadTable
Jason Massie
www: http://statisticsio.com
rss: http://feeds.feedburner.com/statisticsio
<ian.tiesdell@.hotmail.co.uk> wrote in message
news:9f6c966a-b884-4efe-b037-2b339fb5d236@.q1g2000prf.googlegroups.com...
> Hi
> I am trying to run a stored procedure on a linked MySQL server
> i can select from the MySQL server, so i know that there is a valid
> link
> i can run the stored procedure on the MySQL server using the command
> call triodent.UpdateDownloadTable
> but when i try to execute
> exec MYSQL.triodent.UpdateDownloadTable
> i get the "could not locate..." error
> is it because MySQL is using call rather than exec? if so doesn't
> anyone have an idea for the syntax?
> many Thanks
> Ian|||thanks jason but i get
Msg 7212, Level 17, State 1, Line 3
Could not execute procedure 'UpdateDownloadTable' on remote server
'MYSQL'.
:-(|||That's progress. It sounds like it is permissions now. Verify the linked
server user has the rights to execute on MySQL.
--
Jason Massie
www: http://statisticsio.com
rss: http://feeds.feedburner.com/statisticsio
<ian.tiesdell@.hotmail.co.uk> wrote in message
news:f098afcc-03ba-4977-9698-f38b83f34499@.b9g2000prh.googlegroups.com...
> thanks jason but i get
> Msg 7212, Level 17, State 1, Line 3
> Could not execute procedure 'UpdateDownloadTable' on remote server
> 'MYSQL'.
> :-(|||jason wrote:
> That's progress. It sounds like it is permissions now. Verify the linked
> server user has the rights to execute on MySQL.
>
Also check the properties for the linked server and verify RPC is turned on.|||sorry to be dim but how do i check this?
i've looked at server objects/linked servers security settings and i
have
connections will be made using this security context
remote login root
with password and then the password
RPC is turned on
Data Access is True
Ian|||ian.tiesdell@.hotmail.co.uk wrote:
> sorry to be dim but how do i check this?
> i've looked at server objects/linked servers security settings and i
> have
> connections will be made using this security context
> remote login root
> with password and then the password
> RPC is turned on
> Data Access is True
> Ian
Well, if you looked at the linked server properties and saw the RPC is
enabled (there are two options), then that is all you need to do.
Jeff|||so if the security settings are Ok and the syntax is OK?
what else could be wrong?
using
exec MYSQL.triodent..UpdateDownloadTable
Msg 7212, Level 17, State 1, Line 1
Could not execute procedure 'UpdateDownloadTable' on remote server
'MYSQL'|||ian.tiesdell@.hotmail.co.uk wrote:
> so if the security settings are Ok and the syntax is OK?
> what else could be wrong?
> using
> exec MYSQL.triodent..UpdateDownloadTable
> Msg 7212, Level 17, State 1, Line 1
> Could not execute procedure 'UpdateDownloadTable' on remote server
> 'MYSQL'
Only thing I can think of is maybe permission issues in 'MYSQL'? I
don't know 'MYSQL' - so I really can't help with that side.|||I think it could be mySQL causing the problem - what i've done is to
mimic the actions of the stored proc using update statements from
MSSQL over to the linked server
thanks for your input
Ian
Could not locate entry in sysdatabases for database
right folder, but DbB wasn't. So I detached DbB, moved it to the new folder
and reattached it. Everything seems to be working (I can see the database
from Management Studio Express (MSE), the website can access it just fine)
except when I try to backup DbB. Backing up from MSE works without a
problem, however if I try to run this query:
BACKUP DATABASE [DbB] TO DISK = N'C:\WebDb.backup\DbB\DbB.bak' WITH
NOFORMAT, NOINIT, NAME = N'DbB-Full Database Backup', SKIP, NOREWIND,
NOUNLOAD, STATS = 10
GO
with this sqlcmd.exe command:
sqlcmd -i c:\WebBackupScripts\BkDbB.sql -o c:\WebBackupScripts\BkDbB.sql.txt
I get this:
Msg 911, Level 16, State 1, Server DEV, Line 1
Could not locate entry in sysdatabases for database 'DbB'. No entry found
with that name. Make sure that the name is entered correctly.
Msg 3013, Level 16, State 1, Server DEV, Line 1
BACKUP DATABASE is terminating abnormally.
The exact same query runs fine from MSE, but fails when ran from sqlcmd --
the sql was actually generated by MSE. A similar query, but for DbA works
fine from sqlcmd. The only thing that I can think of that's different is
that I've attached/reattached DbB. I've searched the net, but nothing
really helped. Any suggestions?
Thank you,
Peter.
Hello,
Do you have multiple instances of SQL Server in the same server. Just issue
the -S Servername parameter along with
SQLCMD statement and try.
Thanks
Hari
"Peter Zolja" <x@.x.com> wrote in message
news:eYTyx4uPHHA.2140@.TK2MSFTNGP03.phx.gbl...
>I have two database, let's call them DbA and DbB. DbA was already in the
>right folder, but DbB wasn't. So I detached DbB, moved it to the new folder
>and reattached it. Everything seems to be working (I can see the database
>from Management Studio Express (MSE), the website can access it just fine)
>except when I try to backup DbB. Backing up from MSE works without a
>problem, however if I try to run this query:
> BACKUP DATABASE [DbB] TO DISK = N'C:\WebDb.backup\DbB\DbB.bak' WITH
> NOFORMAT, NOINIT, NAME = N'DbB-Full Database Backup', SKIP, NOREWIND,
> NOUNLOAD, STATS = 10
> GO
> with this sqlcmd.exe command:
> sqlcmd -i c:\WebBackupScripts\BkDbB.sql -o
> c:\WebBackupScripts\BkDbB.sql.txt
> I get this:
> Msg 911, Level 16, State 1, Server DEV, Line 1
> Could not locate entry in sysdatabases for database 'DbB'. No entry found
> with that name. Make sure that the name is entered correctly.
> Msg 3013, Level 16, State 1, Server DEV, Line 1
> BACKUP DATABASE is terminating abnormally.
>
> The exact same query runs fine from MSE, but fails when ran from sqlcmd --
> the sql was actually generated by MSE. A similar query, but for DbA works
> fine from sqlcmd. The only thing that I can think of that's different is
> that I've attached/reattached DbB. I've searched the net, but nothing
> really helped. Any suggestions?
> Thank you,
> Peter.
>
|||> Do you have multiple instances of SQL Server in the same server. Just
> issue the -S Servername parameter along with
> SQLCMD statement and try.
Ahaaaaaa... right on the money :-) I have SQL 2005 Express and MSDE on the
same machine. SQL2005 is installed under the SQLExpress instance. So adding
"-S .\SQLExpress" to the sqlcmd parameter list made it work. I'm still
puzzled why that wasn't required for DbA... could it be that DbA is the
"default" database?
In any case, thanks a LOT for you help!
|||Hello,
Yes, thats the default instance.
You will have to give the server instance name if you have multiple servers
in one machine.
Thanks
Hari
"Peter Zolja" <x@.x.com> wrote in message
news:%23tu1GEvPHHA.1248@.TK2MSFTNGP03.phx.gbl...
> Ahaaaaaa... right on the money :-) I have SQL 2005 Express and MSDE on the
> same machine. SQL2005 is installed under the SQLExpress instance. So
> adding "-S .\SQLExpress" to the sqlcmd parameter list made it work. I'm
> still puzzled why that wasn't required for DbA... could it be that DbA is
> the "default" database?
> In any case, thanks a LOT for you help!
>
|||Thanks to Hari! You're a life saver. Where were you 5 hours ago?
From http://www.developmentnow.com/g/118_2007_1_0_0_928077/Could-not-locate-entry-in-sysdatabases-for-database.htm
Posted via DevelopmentNow.com Groups
http://www.developmentnow.com
Sunday, March 11, 2012
Could not locate entry in sysdatabases for database
right folder, but DbB wasn't. So I detached DbB, moved it to the new folder
and reattached it. Everything seems to be working (I can see the database
from Management Studio Express (MSE), the website can access it just fine)
except when I try to backup DbB. Backing up from MSE works without a
problem, however if I try to run this query:
BACKUP DATABASE [DbB] TO DISK = N'C:\WebDb.backup\DbB\DbB.bak' WITH
NOFORMAT, NOINIT, NAME = N'DbB-Full Database Backup', SKIP, NOREWIND,
NOUNLOAD, STATS = 10
GO
with this sqlcmd.exe command:
sqlcmd -i c:\WebBackupScripts\BkDbB.sql -o c:\WebBackupScripts\BkDbB.sql.txt
I get this:
Msg 911, Level 16, State 1, Server DEV, Line 1
Could not locate entry in sysdatabases for database 'DbB'. No entry found
with that name. Make sure that the name is entered correctly.
Msg 3013, Level 16, State 1, Server DEV, Line 1
BACKUP DATABASE is terminating abnormally.
The exact same query runs fine from MSE, but fails when ran from sqlcmd --
the sql was actually generated by MSE. A similar query, but for DbA works
fine from sqlcmd. The only thing that I can think of that's different is
that I've attached/reattached DbB. I've searched the net, but nothing
really helped. Any suggestions?
Thank you,
Peter.Hello,
Do you have multiple instances of SQL Server in the same server. Just issue
the -S Servername parameter along with
SQLCMD statement and try.
Thanks
Hari
"Peter Zolja" <x@.x.com> wrote in message
news:eYTyx4uPHHA.2140@.TK2MSFTNGP03.phx.gbl...
>I have two database, let's call them DbA and DbB. DbA was already in the
>right folder, but DbB wasn't. So I detached DbB, moved it to the new folder
>and reattached it. Everything seems to be working (I can see the database
>from Management Studio Express (MSE), the website can access it just fine)
>except when I try to backup DbB. Backing up from MSE works without a
>problem, however if I try to run this query:
> BACKUP DATABASE [DbB] TO DISK = N'C:\WebDb.backup\DbB\DbB.bak' WITH
> NOFORMAT, NOINIT, NAME = N'DbB-Full Database Backup', SKIP, NOREWIND,
> NOUNLOAD, STATS = 10
> GO
> with this sqlcmd.exe command:
> sqlcmd -i c:\WebBackupScripts\BkDbB.sql -o
> c:\WebBackupScripts\BkDbB.sql.txt
> I get this:
> Msg 911, Level 16, State 1, Server DEV, Line 1
> Could not locate entry in sysdatabases for database 'DbB'. No entry found
> with that name. Make sure that the name is entered correctly.
> Msg 3013, Level 16, State 1, Server DEV, Line 1
> BACKUP DATABASE is terminating abnormally.
>
> The exact same query runs fine from MSE, but fails when ran from sqlcmd --
> the sql was actually generated by MSE. A similar query, but for DbA works
> fine from sqlcmd. The only thing that I can think of that's different is
> that I've attached/reattached DbB. I've searched the net, but nothing
> really helped. Any suggestions?
> Thank you,
> Peter.
>|||> Do you have multiple instances of SQL Server in the same server. Just
> issue the -S Servername parameter along with
> SQLCMD statement and try.
Ahaaaaaa... right on the money :-) I have SQL 2005 Express and MSDE on the
same machine. SQL2005 is installed under the SQLExpress instance. So adding
"-S .\SQLExpress" to the sqlcmd parameter list made it work. I'm still
puzzled why that wasn't required for DbA... could it be that DbA is the
"default" database?
In any case, thanks a LOT for you help!|||Hello,
Yes, thats the default instance.
You will have to give the server instance name if you have multiple servers
in one machine.
Thanks
Hari
"Peter Zolja" <x@.x.com> wrote in message
news:%23tu1GEvPHHA.1248@.TK2MSFTNGP03.phx.gbl...
>> Do you have multiple instances of SQL Server in the same server. Just
>> issue the -S Servername parameter along with
>> SQLCMD statement and try.
> Ahaaaaaa... right on the money :-) I have SQL 2005 Express and MSDE on the
> same machine. SQL2005 is installed under the SQLExpress instance. So
> adding "-S .\SQLExpress" to the sqlcmd parameter list made it work. I'm
> still puzzled why that wasn't required for DbA... could it be that DbA is
> the "default" database?
> In any case, thanks a LOT for you help!
>|||Thanks to Hari! You're a life saver. Where were you 5 hours ago
From http://www.developmentnow.com/g/118_2007_1_0_0_928077/Could-not-locate-entry-in-sysdatabases-for-database.ht
Posted via DevelopmentNow.com Group
http://www.developmentnow.com
Could not locate entry in sysdatabases for database
right folder, but DbB wasn't. So I detached DbB, moved it to the new folder
and reattached it. Everything seems to be working (I can see the database
from Management Studio Express (MSE), the website can access it just fine)
except when I try to backup DbB. Backing up from MSE works without a
problem, however if I try to run this query:
BACKUP DATABASE [DbB] TO DISK = N'C:\WebDb.backup\DbB\DbB.bak' WITH
NOFORMAT, NOINIT, NAME = N'DbB-Full Database Backup', SKIP, NOREWIND,
NOUNLOAD, STATS = 10
GO
with this sqlcmd.exe command:
sqlcmd -i c:\WebBackupScripts\BkDbB.sql -o c:\WebBackupScripts\BkDbB.sql.txt
I get this:
Msg 911, Level 16, State 1, Server DEV, Line 1
Could not locate entry in sysdatabases for database 'DbB'. No entry found
with that name. Make sure that the name is entered correctly.
Msg 3013, Level 16, State 1, Server DEV, Line 1
BACKUP DATABASE is terminating abnormally.
The exact same query runs fine from MSE, but fails when ran from sqlcmd --
the sql was actually generated by MSE. A similar query, but for DbA works
fine from sqlcmd. The only thing that I can think of that's different is
that I've attached/reattached DbB. I've searched the net, but nothing
really helped. Any suggestions?
Thank you,
Peter.Hello,
Do you have multiple instances of SQL Server in the same server. Just issue
the -S Servername parameter along with
SQLCMD statement and try.
Thanks
Hari
"Peter Zolja" <x@.x.com> wrote in message
news:eYTyx4uPHHA.2140@.TK2MSFTNGP03.phx.gbl...
>I have two database, let's call them DbA and DbB. DbA was already in the
>right folder, but DbB wasn't. So I detached DbB, moved it to the new folder
>and reattached it. Everything seems to be working (I can see the database
>from Management Studio Express (MSE), the website can access it just fine)
>except when I try to backup DbB. Backing up from MSE works without a
>problem, however if I try to run this query:
> BACKUP DATABASE [DbB] TO DISK = N'C:\WebDb.backup\DbB\DbB.bak' WITH
> NOFORMAT, NOINIT, NAME = N'DbB-Full Database Backup', SKIP, NOREWIND,
> NOUNLOAD, STATS = 10
> GO
> with this sqlcmd.exe command:
> sqlcmd -i c:\WebBackupScripts\BkDbB.sql -o
> c:\WebBackupScripts\BkDbB.sql.txt
> I get this:
> Msg 911, Level 16, State 1, Server DEV, Line 1
> Could not locate entry in sysdatabases for database 'DbB'. No entry found
> with that name. Make sure that the name is entered correctly.
> Msg 3013, Level 16, State 1, Server DEV, Line 1
> BACKUP DATABASE is terminating abnormally.
>
> The exact same query runs fine from MSE, but fails when ran from sqlcmd --
> the sql was actually generated by MSE. A similar query, but for DbA works
> fine from sqlcmd. The only thing that I can think of that's different is
> that I've attached/reattached DbB. I've searched the net, but nothing
> really helped. Any suggestions?
> Thank you,
> Peter.
>|||> Do you have multiple instances of SQL Server in the same server. Just
> issue the -S Servername parameter along with
> SQLCMD statement and try.
Ahaaaaaa... right on the money :-) I have SQL 2005 Express and MSDE on the
same machine. SQL2005 is installed under the SQLExpress instance. So adding
"-S .\SQLExpress" to the sqlcmd parameter list made it work. I'm still
puzzled why that wasn't required for DbA... could it be that DbA is the
"default" database?
In any case, thanks a LOT for you help!|||Hello,
Yes, thats the default instance.
You will have to give the server instance name if you have multiple servers
in one machine.
Thanks
Hari
"Peter Zolja" <x@.x.com> wrote in message
news:%23tu1GEvPHHA.1248@.TK2MSFTNGP03.phx.gbl...
> Ahaaaaaa... right on the money :-) I have SQL 2005 Express and MSDE on the
> same machine. SQL2005 is installed under the SQLExpress instance. So
> adding "-S .\SQLExpress" to the sqlcmd parameter list made it work. I'm
> still puzzled why that wasn't required for DbA... could it be that DbA is
> the "default" database?
> In any case, thanks a LOT for you help!
>|||Thanks to Hari! You're a life saver. Where were you 5 hours ago?
From http://www.developmentnow.com/g/118...or-database.htm
Posted via DevelopmentNow.com Groups
http://www.developmentnow.com
could not locate entry in sysdatabases
I had created a database in sql server but since then installed windows xp pro and now when i go through the microsoft sql server dsn configuration the database is not valid and therefore i cannot change the default database as it says it doesn't exist.
So then when i type in command prompt use 'db' it says it doesn't exist but when i try to create 'db' it says that the database already exists.
I get the error message, could not locate entry in sysdatabases for 'cti' (database name).
When i look in mysql - data - along with master etc there is my cti.mdf and log files??
I'm stuck?
Is it that the files just aren't registering through sql server?
Please help!Have you tried using enterprise manager or query analyzer ? Also, can you be more specific when you say "installed windows xp pro". Which version of sql server are you using ? When you configure your dsn, what are you putting in the "Server" dropdown ? Have any of your security settings changed and which type of security are you using to access sql server ? Have you tried to create a new dsn ?|||Hey there, i use (local) for the server in the dsn configuration.
I have just put on windows xp pro sp1 - I orginally had an earlier windows xp pro.
I'm using sql server 2000 sp3
All security settings have remained the same and I've tried to do new dsn's but they still don't register that the database files aren't in the sysdatabases.
Could not locate entry (stored procedure error)
hello everyone,
I am using VS 2005 and sql server 2000. I have a web application which uses a connectionstring with a user id and pwd. Everything is fine, I can execute normal sql statements from the code behind. I cannot execute a stored procedure...I get this error.
Could not locate entry in sysdatabases for database 'exec usp_add2DB (my parameters are included here, deleted for simplicity reasons)
No entry found with that name. Make sure that the name is entered correctly.
I have given execute permission for the user, and the name of the storedproc is correct. the name of the server is also correct...pls pls help me what is wrong here...
Post the code you have and someone here can help.|||
Thank you for the response.here is the code...shortened for simplicity sake.
BtnClick event:
string sql = exec sp_add2DB '" + tShiptoSiteNo.Text +"','" txtShipToSiteName.Text
ClassA a = new ClassA("dev_connectionstr");
if(a.ExecuteSP(sql))
{
Response.Write("executed");
}
I am using enterprise library 2.0: (Everything is set up properly,pretty confident about it ,because many apps i am using it).
In Class A:
public class A :BaseDAO
{
public bool ExecuteSP(string sql)
{
DbCommand dbCommand = SqlDatabase.GetStoredProcCommand(sql);
int a = SqlDatabase.ExecuteNonQuery(dbCommand);
return true;}
In web.config:
<connectionStrings>
<add name ="dev_connectionstr" connectionString ="Data Source=ServerName;Initial Catalog=TestDB;User ID=test_user;Password=xxxx" providerName ="System.Data.SqlClient"/>
</connectionStrings>
Thanks for the help.
Hi sankar,
When executing a stored procedure, you cannot list your parameters after the stored procedure name and execute with EXEC.
You need to create a SqlCommand object, and make CommandText as "sp_add2DB". Then use SqlCommand.Parameters.Add() method to add the parameters one by one. After this is done, open the connection and call SqlCommand.ExecuteNonQuery to execute it.
|||Thanks a lot for the reply Kevin Yu....tht explains why! Thank you very much!.