- Select All Databases from a Server (this is a system stored procedure)
- Select All Tables from a Particular Database
This webpage has a lot of examples: -
http://www.asp.net/ajax/documentation/live/overview/UpdatePanelOverview.aspx
81 unique visitors(configuration)
(appSettings)
(add key="mstrConnectionString" value="user id=abcd; password=1234; server=VAIJAYANTA-PC\SQLEXPRESS; database="VaijayantaTest" /)
(/appSettings)
(/configuration)
or
(configuration)
(connectionStrings)
(add name="mstrConnectionString" connectionString="user id=abcd; password=1234 server=VAIJAYANTA-PC\SQLEXPRESS; database="VaijayantaTest" /)
(/connectionStrings)
(/configuration)
string StrCon;
StrCon = ConfigurationSettings.AppSettings.Get("mstrConnectionString");
Sqlconnection conn = new SqlConnection(StrCon );
conn.Open();
SqlCommand cmd = new SqlCommand(select,conn);
rest follows.........
72 unique visitors
---------------------------------------------------------------------------
source = "server=(local); integrated security=SSPI; database=Northwind";
select = "select * from Customers";
Sqlconnection conn = new SqlConnection(source);
conn.Open();
SqlCommand cmd = new SqlCommand(select,conn);
int rowsReturned = cmd.ExecuteNonQuery(); //returns no of rows affected
---------------------------
SqlDataReader reader = cmd.ExecuteReader();
while(reader.Read())
{
ConsoleWriteline(reader[0], reader[1]); //returns a set of values
} // by iterating through records
-------------------------
object o = cmd.ExecuteScalar();
Console.WriteLine(o); // returns a column
-----------------
XmlReader xr = cmd.ExecuteXmlReader();
xr.Read(); // returns a XmlReaderObject
--------------
SqlDataAdapter da = new SqlDataAdapter(select, conn);
DataSet ds = new DataSet();
da.Fill(ds,"Customers"); //runtime schema generation
---------------------------------------------------------------------------
68 unique visitors
A database trigger is procedural code that is automatically executed in response to certain events on a particular table in a database. Triggers can restrict access to specific data, perform logging, or audit data modifications.
Difference between a trigger and a stored procedure
1- when you create a trigger you have to identify event and action of your trigger but when you create s.p you don't identify event and action
2-trigger is run automatically if the event is occured but s.p don't run automatically but you have to run it manually
3- within a trigger you can call specific s.p but within a s.p you cann;t call atrigger
68 unique visitorsStep 1 – Create Excel worksheet
1) Open Microsoft Excel and create a new Worksheet.
2) The sample data is as follows: - (any sample data)
We will keep the default name for the Worksheet (Sheet1).
3) Let us name and save the excel file as Running.xls.
Note: You can download the Excel file along with the code files from the Downloads section at the end of this article.
Step 2 –Display Excel Data using GridView Control
1) Start Visual Studio 2005.
2) Select Create Website and choose the Template ASP.NET Web Site. We can choose the language as C#/VB. Set the name for the project as ExcelGV.
3) Add the existing Excel file (Running.xls) that we created to the App_data folder.
4) Add a new .aspx file. Choose language C#/VB and, depending on the language, we will set the appropriate names: ExcelGVCS.aspx for C# or ExcelGVVB for VB.NET.
4) Drag and drop the GridView control on the .aspx page.
5) We will add the following statement in code behind above the namespace section.