SELECT column_name from information_schema.columns
WHERE table_name LIKE ‘%Login%’
AND data_type like ‘varchar’
ORDER BY column_name
Monthly Archives: May 2009
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 Gridview Display Only Date and Only Time like 11:15 PM
For Only Date
<asp:BoundField DataField=”Date” HeaderText=”Date” dataformatstring=”{0:MM/dd/yyyy}” htmlencode=”false”/>
For Only Time
<asp:BoundField DataField=”Time” DataFormatString=”{0:HH:mm tt}” HtmlEncode=”False” HeaderText=”Your Time” >
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 Time Format 12-Hour With AM/PM
In Asp.net Time Format
Label1.Text = DateTime.Today.ToString(“hh:mm tt”);
Sql server Only Select Time
SELECT REPLACE(REPLACE(RIGHT(‘0’+LTRIM(RIGHT(CONVERT(varchar,getDate(),100),7)),7),’AM’,’ AM’),’PM’,’ PM’)as Date
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;
}
}
Drive Double Click Not Open Problem
Delete the autorun.inf file fro, commnand Prompt
Follow the Steps
1. Go to ‘Run” type “cmd’ the Command promt window will open..
2. type “cd”
3. if C drive ,type ” C:
4. type “attrib -r -h -s autorun.inf”
5. del autorun.inf
Then Restart the computer
Shutdown & Restart from Commnad Prompt
Shutdown & Restart Shortcuts for Windows XP & Windows 2000
Click Start, click Run, type CMD,
For a shortcut to RESTART Windows XP:
SHUTDOWN -r -t 01
For a shortcut to SHUT DOWN Windows XP:
SHUTDOWN -s -t 01