ASP.Net MSAccess Error “Operation must use an updateable query” error

If you are not using NTFS–if you are still using Fat16 or Fat32–then it should not appear.
But by the same token, you shouldn’t have a need for it on such file systems.

If you are using NTFS–and especially if you are using WindowsXP–then try the following steps:

(1) Bring up “Windows Explorer” or “My Computer” in a window.
(2) Click on the “Tools” menu in that window.
(3) Click on the “Folder Options” menu item.
(4) Click on the “View” tab.
(5) Find the checkbox labelled “Use simple file sharing (Recommended)”
(6) UNCHECK that checkbox!
(7) Say OK. Close the dialog. Close the window.
(8) You might have to log off and back on again. I didn’t, but others have reported they had to.
(9) Now go view the properties of a folder or file with Windows Explorer/My Computer and see if the Security tab isn’t there!

Than Allow Appropriate Rights to that File. And Check For Error

Enjoy……..

Difference between Stored procedures and User Defined functions

Stored procedure
A stored procedure is a program (or procedure) which is physically stored within a database. They are usually
written in a proprietary database language like PL/SQL for Oracle database or PL/PgSQL for PostgreSQL.
The advantage of a stored procedure is that when it is run, in response to a user request,
it is run directly by the database engine, which usually runs on a separate database server.
As such, it has direct access to the data it needs to manipulate and only needs to send its results back to the user,
doing away with the overhead of communicating large amounts of data back and forth.

User-defined function
A user-defined function is a routine that encapsulates useful logic for use in other queries. While views are limited to a single SELECT statement, user-defined functions can have multiple SELECT statements and provide more powerful logic than is possible with views.

In SQL Server 2000
User defined functions have 3 main categories

1. Scalar-valued function – returns a scalar value such as an integer or a timestamp. Can be used as column name in queries
2. Inline function – can contain a single SELECT statement.
3. Table-valued function – can contain any number of statements that populate the table variable to be returned. They become handy when you need to return a set of rows, but you can’t enclose the logic for getting this rowset in a single SELECT statement.

Differences between Stored procedure and User defined functions

1. UDF can be used in the SQL statements anywhere in the WHERE/HAVING/SELECT section where as Stored procedures cannot be.
2. UDFs that return tables can be treated as another rowset. This can be used in JOINs with other tables.
3. Inline UDF’s can be though of as views that take parameters and can be used in JOINs and other Rowset operations.
4. Of course there will be Syntax differences and here is a sample of that

Asp.Net Datalist Assign Autonumber

If  u want to assign Datalist item count then write the following code in ItemDataBound  of Datalist protected void Datalist1_ItemDataBound(object sender, DataListItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
if (dd.Tables[0].Rows.Count > 0)
{
Label id = e.Item.FindControl(“lblId”) as Label;
int auto = e.Item.ItemIndex + 1;
id.Text = ” Item ” + auto.ToString();
}

}
}

This Code will find the Lable in Datalist and Assign it  Auto number.

Asp.net File Upload

Import the following Namespace
using System.IO;

1. For Full File Name With Path
FileUpload1.PostedFile.FileName;
2.Get Client Directory for that File
Path.GetDirectoryName(FileUpload1.PostedFile.FileName);
3.Get File Extension
Path.GetExtension(FileUpload1.PostedFile.FileName).ToString().Trim().Remove(0, 1);
4.Get Only File Name Without Extension
Path.GetFileNameWithoutExtension(FileUpload1.PostedFile.FileName);
5.Get File Size
FileUpload1.PostedFile.ContentLength;
6. To Save File on Server on Your Location
string SaveLocation;
SaveLocation = Server.MapPath(“..\\UploadFile\\YourFoldername”) + “\\” + FileUpload1.FileName;
FileUpload1.PostedFile.SaveAs(SaveLocation);

Asp.net TabPanel Select Active Tab On Page PostBack

Write Following Code in

protected void Page_Init(object sender, EventArgs e)
{

}
Or you can also Set as per your Requirement

if (Request.Params[“__EVENTTARGET”] != null)
{
string control = Request.Params[“__EVENTTARGET”];
for (int i = 0; i < TabContainer1.Tabs.Count; i++)
if (control.Contains(TabContainer1.Tabs[i].UniqueID + “$”))
{
TabContainer1.ActiveTabIndex = i;
}
}