Wednesday, April 13, 2005

RECORD COUNT ADO.NET, C#

Moojjoo Blog

THE FOLLOWING CODE IS FOR COUNTING RECORDS IN A DATABASE USING ADO.NET, C#

//string countSQL = "SELECT COUNT(userID) FROM CamelHeadCount WHERE userID =" + GetUserName();
string countSQL = "SELECT COUNT(userID) FROM CamelHeadCount WHERE userID = 'DANNELR'";
SqlConnection Conn = new SqlConnection(strConn);
SqlCommand myCommand = new SqlCommand(countSQL, Conn);

Conn.Open();
Int32 recordCount = (Int32) myCommand.ExecuteScalar();

if (recordCount > 0)
{
Response.Write("Our records indicate that you have already confirmed");
Response.End();
}
Conn.Close();

Saturday, April 02, 2005

ADO.NET Error Occurred: Operation must use an updateable query

Error Occurred: Operation must use an updateable query.I keep receiving the following error: 'sliderbutton.gif' Received...Content-Type: image/gifContent-Length: 138File Name: Y:\documents\Another6\sliderbutton.gifError Occurred: Operation must use an updateable query.Does anyone know what is the problem? Thank you for your time.Victorponce22@yahoo.com
Reply

Posted by Faisal Khan on November-22-2003
Give READ/WRITE permissionsYou'll have to give READ/WRITE permissions for the user IUSR_MACHINENAME to the folder where you are trying to upload (i.e. write) files.------------------Faisal Khan.Stardeveloper.com
In Reply To Reply

Posted by spectreman on January-14-2004
This fix worked for me.I found this on another board. I'm using XP pro, which apparently hides true folder permissions control by default... after you turn of this stupid feature, you can then give 'write' permission to All Users for the .mdb.Here's how:okay Chris_Gilbert and all others who have the same Access DB problem. I provided the solution in pervious post for W2K. I was then having same problem on XP Pro and I have solved the problem after searching a LOT. Okay, here is the solution: - open the Explorer - click on Tools and then Folder Options - goto View tab - scroll down all the way and the last item (i think) will say "Use simple file sharing" - uncheck it if it is checked - now, goto appropriate .mdb file and right click - click on properties - goto Security tab - select Everyone from User - check "Write" checkbox under Everyone as a user VOILA.......You have done it!!!!!! This should work now. It worked for me and now I can run SQL command from frontend to update my Access database.
In Reply To Reply

Posted by jrgonline on November-11-2004
This didn't workthis fix didn't work for me.... i'm still getting the same error. i used the files that were available in the ZIP at the end of this article... do I need to change something within any of those files?------------------"America cannot lead the world's future if our elected officials keep us chained to tradition."
In Reply To Reply

Posted by zedfalco on March-29-2005
thanks a lot spectremanthat`s has worked for me. After I was looking for a solution the all day!Thank