hello all
i have problem :

string sssql = "SELECT *FROM BooksCatalog WHERE BookID = '" + TB[2].Text + "'";
 ds =DBC.Read(sssql); // class that read from sql
                    foreach (DataRow row in ds.Tables[0].Rows)
                    {
                        row["BorrowState"] = "good"; // that not write that in my database here its the problem
                    }

please help me
thankss

Recommended Answers

All 7 Replies

Member Avatar for stbuchok

Why would that write anything to your database? If you want to insert anything into your database, you use "Insert Into...". I think you need to learn some SQL.

http://www.w3schools.com/sql/default.asp

commented: Funny and constructive +2

thank you ... now i know that i really dont know sql...

instead of:
string sssql = "SELECT *FROM
use:
string sssql = "SELECT * FROM
there must be a space after the (*) sign

Member Avatar for stbuchok

mmaenb, you are wrong sir. I have just tested in SQL Server Management Studio and you can do Select *From TableName and it runs fine. It is proper to have a space after for readability, however it is not mandatory.

First all add space after *.If it does not work then check your table is there are entries or not.

You need to use UPDATE statement to update rows.

sql="update BooksCatalog set BorrorState='good' WHERE BookID = '" + TB[2].Text + "'";
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.