Showing posts with label marked. Show all posts
Showing posts with label marked. Show all posts

Monday, March 19, 2012

help needed with this query

i have marked in bold the query in question ..whch gives me the the runtime error mentioned at the below , i double checked everything all the table names and the field names are correct so whats the problem , please anyone??

im really stumped!

if (Radio_Btn_Book.Checked == true)
{
string book_query = "update Issue_Book_Reserve I set I.Issue_Book_Reserve_state = 1 where I.Book_Id = Books.Book_Id and Books.Book_Name = '" + Session["Book_name"].ToString()+"'";

SqlCommand Cmd_book = new SqlCommand(book_query, con);

con.Open();
Cmd_book.ExecuteNonQuery();
con.Close();
}

ERROR:

The column prefix 'Books' does not match with a table name or alias name used in the query.
The column prefix 'Books' does not match with a table name or alias name used in the query.

string book_query = "update Issue_Book_Reserve I set I.Issue_Book_Reserve_state = 1 where I.Book_Id =Books.Book_Id and Books.Book_Name = '" + Session["Book_name"].ToString()+"'";

whats this ? there is no reference of books table please check ... or change it to

whats is this Books ? is it a object in that case use query like this

string book_query = "update Issue_Book_Reserve I set I.Issue_Book_Reserve_state = 1 where I.Book_Id = " +Books.Book_Id + " and I.Book_Name = '" + Session["Book_name"].ToString()+"'";

not sure what this Books is ...

|||

there are 2 tables in the query

Issue_Book_reference and Books

|||

1update Issue_Book_Reserve I2set I.Issue_Book_Reserve_state = 13from Books B4where I.Book_Id = B.Book_Idand B.Book_Name ='" + Session["Book_name"].ToString()+"'";
 
use this sql

Friday, February 24, 2012

Help me please! (production DB marked as suspicious)

Hi everybody,

DBMS - MS SQL 6.5
I have removed physical files: Name.DAT and NameLog.DAT
from folder and put older files there with the same names.
After restarting the engine has marked my DB as suspicious.

Then I moved previous files back - database still suspitious!!!

I have no idea how to restore data base status after removing phisical files?

I need help as my MS SQL 6.5 marked as suspicious my production
database.If you can replace the DB by this way,why MS give some backup,restore function?|||If you don't have a valid backup and all you have is the .Dat and .Log files. Try attaching those rather than just replacing the old files. Otherwise have a look at sp_resetstatus.

Cheers|||Sorry, I just noticed that you are on version 6.5. I'm not sure if the info will be valid for that version, you will have to try it to find out.

Thanks,

Originally posted by bmalar
If you don't have a valid backup and all you have is the .Dat and .Log files. Try attaching those rather than just replacing the old files. Otherwise have a look at sp_resetstatus.

Cheers|||True you should use SP_RESETSTATUS, before that use:

sp_configure 'allow updates',1
go
reconfigure with override
go

After the procedure is created, immediately disable updates to the system tables.
sp_configure 'allow updates',0
go

reconfigure with override
go

... then use SP_RESETSTATUS and reboot the server.