|
Response.Redirect("practical.aspx?name="+TextBox1.Text+" &city="+TextBox2 .Text ); \\create QueryString in one page
TextBox9.Text = Request.QueryString["name"];
TextBox10.Text = Request.QueryString["city"];//like we can call the QueryString value
|
|
|
|
|
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
{
SqlCommand cmd1 = new SqlCommand();
cmd1.Connection = con;
cmd1.CommandText = "select * from personal1 where emp_id='" + DropDownList1.SelectedValue + "'";
cmd1.CommandType = CommandType.Text;
SqlDataAdapter adp1 = new SqlDataAdapter();
adp1.SelectCommand = cmd1;
DataSet1 ds1 = new DataSet1();
adp1.Fill(ds1, "personal1");
ReportDocument rpt1 = new ReportDocument();
rpt1.Load(Server.MapPath("CrystalReport1.rpt"));
rpt1.SetDataSource(ds1);
CrystalReportViewer1.ReportSource = rpt1;
CrystalReportViewer1.Visible = true;
}
|
|
|
|
|
<object style="height: 101px; width: 750px" class="style1">
<param name="movie" value="IMAGES/euro/euro.swf">
<embed src="IMAGES/euro/euro.swf" width="720" height="100">
</embed>
</object>
|
|
|
|
|
string myHost = System.Net.Dns.GetHostName();
string str = System.Net.Dns.GetHostByName(myHost).AddressList[0].ToString();
//Response.Write(myHost);
Response.Write(str);
|
|
|
|
|
Dim objConnection As Data.OleDb.OleDbConnection
Dim objCmd As Data.OleDb.OleDbCommand
Dim strConnection As String
Dim strSQL As String
strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" + MapPath("database2.mdb")
' Create and open the connection object
objConnection = New Data.OleDb.OleDbConnection(strConnection)
objConnection.Open()
' set the SQL string
strSQL = "INSERT INTO table1(id,name1,address)" & _
" VALUES ( '" & TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "')"
' Create the Command and set its properties
objCmd = New Data.OleDb.OleDbCommand(strSQL, objConnection)
' execute the command
objCmd.ExecuteNonQuery()
Label4.Text = "Command run"
|
|
|
|
|
strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" + MapPath("database2.mdb")
' Create and open the connection object
objConnection = New Data.OleDb.OleDbConnection(strConnection)
objConnection.Open()
' set the SQL string
strSQL = "update table1 set name1='" & TextBox2.Text & "',address='" & TextBox3.Text & "' where id = " & TextBox1.Text & ""
' Create the Command and set its properties
objCmd = New Data.OleDb.OleDbCommand(strSQL, objConnection)
' execute the command
objCmd.ExecuteNonQuery()
Label4.Text = "RECORD IS UPDATED"
|
|
|
|
|
strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" + MapPath("database2.mdb")
' Create and open the connection object
objConnection = New Data.OleDb.OleDbConnection(strConnection)
objConnection.Open()
' set the SQL string
strSQL = "delete from table1 where id = " & TextBox1.Text & ""
' Create the Command and set its properties
objCmd = New Data.OleDb.OleDbCommand(strSQL, objConnection)
' execute the command
objCmd.ExecuteNonQuery()
Label4.Text = "RECORD IS DELETED"
|
|
|
|
|
using System.Data.SqlClient;
SqlConnection con1 = new SqlConnection("Data Source=INFOTECH-YP9BUE\\INFOTECHAHM;Initial Catalog=database1;Integrated Security=True");
SqlCommand cmd1 = new SqlCommand("Insert into table1(id,name,address,age)values(@p1,@p2,@p3,@p4)", con1);
cmd1.Connection.Open();
cmd1.Parameters.Add("@p1", SqlDbType.Int).Value = TextBox1.Text;
cmd1.Parameters.Add("@p2", SqlDbType.NChar).Value = TextBox2.Text;
cmd1.Parameters.Add("@p3", SqlDbType.NChar).Value = TextBox3.Text;
cmd1.Parameters.Add("@p4", SqlDbType.Int).Value = DropDownList1.SelectedItem.ToString();
cmd1.ExecuteNonQuery();
cmd1.Connection.Close();
TextBox1.Text = "";
TextBox2.Text = "";
TextBox3.Text = "";
Response.Write("Record in inserted");
}
|
|
|
|
|
SqlConnection con1 = new SqlConnection("Data Source=INFOTECH-YP9BUE\\INFOTECHAHM;Initial Catalog=database1;Integrated Security=True");
string str2 = "select name,address,age from table1 where id='" + TextBox1.Text + "'";
SqlCommand cmd1 = new SqlCommand(str2, con1);
cmd1.Connection.Open();
SqlDataReader r1 = cmd1.ExecuteReader();
//TextBox3.Text = "";
//while (r1.Read())
//{ TextBox2.Text = r1.GetValue(0).ToString();
// TextBox3.Text = r1.GetValue(1).ToString();
// Response.Write("Record is opened");
// }
if (r1.Read())
{
TextBox2.Text = r1.GetValue(0).ToString();
TextBox3.Text = r1.GetValue(1).ToString();
DropDownList1.Text = r1.GetValue(2).ToString();
//DropDownList1.Items = r1.GetValue(2).ToString();
Response.Write("Record is opened");
}
else
{
TextBox2.Text = "";
TextBox3.Text = "";
Response.Write("Invalid id");
}
r1.Close();
cmd1.Connection.Close();
}
|
|
|
|
|
SqlConnection con1 = new SqlConnection("Data Source=INFOTECH-YP9BUE\\INFOTECHAHM;Initial Catalog=database1;Integrated Security=True");
string str2 = "delete from table1 where id='" + TextBox1.Text + "'";
SqlCommand cmd1 = new SqlCommand(str2, con1);
cmd1.Connection.Open();
SqlDataReader r1 = cmd1.ExecuteReader();
if (r1.Read())
{
Response.Write("Record is DEleted");
}
else
{
TextBox2.Text = "";
TextBox3.Text = "";
Response.Write("Invalid id");
}
r1.Close();
cmd1.Connection.Close();
|
|
|
|
|
SqlConnection con = new SqlConnection("Data Source=INFOTECH-EDF71E\\SQLEXPRESS;Initial Catalog=grid;Integrated Security=True;Pooling=False");
SqlDataAdapter ad = new SqlDataAdapter("select * from customer WHERE name='" + TextBox1.Text+ "'",con);
DataSet ds = new DataSet();
ad.Fill(ds, "customer");
GridView1.DataSource = ds ;
GridView1.DataBind();
|
|
|
|
|
if (FileUpload1.HasFile)
{
FileUpload1.SaveAs("E:\\pradeep_Document\\WebSite1\\new\\" + FileUpload1.FileName + ".jpg");
Label1.Text = "name=" + FileUpload1.FileName + "type=" + FileUpload1.PostedFile.ContentType + "size" + FileUpload1.PostedFile.ContentLength;
}
else
{
Label1.Text = "Selct image";
}
//if (FileUpLoad1.HasFile)
//{
// //Uncomment this line to Save the uploaded file
// //FileUpLoad1.SaveAs("C:\SomePhysicalPath" + FileUpLoad1.Filename);
// Label1.Text = "Received " + FileUpLoad1.FileName + " Content Type " + FileUpLoad1.PostedFile.ContentType + " Length " + FileUpLoad1.PostedFile.ContentLength;
//}
//else
//{
// Label1.Text = "No uploaded file";
//}
|
|
|
|
|
Define Variable
Dim myConnection As New SqlClient.SqlConnection
Dim myCommand As New SqlClient.SqlCommand
Dim ra As Integer
Dim dr As SqlClient.SqlDataReader
Dim str As String
Insert Querry
myConnection = New SqlClient.SqlConnection("Data Source=INFOTECH-YP9BUE\INFOTECHAHM;Initial Catalog=rock;Persist Security Info=True;User ID=sa; password=sa;Pooling=False")
'you need to provide password for sql server
myConnection.Open()
str = "Insert into adddata values ('" & TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "')"
myCommand = New SqlClient.SqlCommand(str, myConnection)
ra = myCommand.ExecuteNonQuery()
MessageBox.Show("New Row Inserted")
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
myConnection.Close()
|
|
|
|
|
Try
myConnection = New SqlClient.SqlConnection("Data Source=INFOTECH-YP9BUE\INFOTECHAHM;Initial Catalog=rock;Persist Security Info=True;User ID=sa; password=sa;Pooling=False")
'you need to provide password for sql server
myConnection.Open()
str = ("select name,address from adddata where id='" & TextBox1.Text & "'")
myCommand = New SqlClient.SqlCommand(str, myConnection)
'Dim dr As SqlClient.SqlDataReader
dr = myCommand.ExecuteReader
If dr.Read Then
TextBox2.Text = dr.GetValue(0)
TextBox3.Text = dr.GetValue(1)
End If
myConnection.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
|
|
|
|
|
myConnection = New SqlClient.SqlConnection("Data Source=INFOTECH-YP9BUE\INFOTECHAHM;Initial Catalog=rock;Persist Security Info=True;User ID=sa; password=sa;Pooling=False")
myConnection.Open()
myCommand = New SqlClient.SqlCommand("Update adddata Set name='" & TextBox2.Text & "',address='" & TextBox3.Text & "' where id='" & TextBox1.Text & "'", myConnection)
ra = myCommand.ExecuteNonQuery()
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
MessageBox.Show("Records affected" & ra)
myConnection.Close()
|
|
|
|
|
myConnection = New SqlClient.SqlConnection("Data Source=INFOTECH-YP9BUE\INFOTECHAHM;Initial Catalog=rock;Persist Security Info=True;User ID=sa;Password=sa;pooling=False")
myConnection.Open()
myCommand = New SqlClient.SqlCommand("delete from adddata where id='" & TextBox1.Text & "'", myConnection)
ra = myCommand.ExecuteNonQuery()
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
MessageBox.Show("Records has Delete")
myConnection.Close()
|
|
|
|
|
//Databind Dropdownlist control//
SqlConnection con = new SqlConnection("Data Source=INFOTECH-YP9BUE\\INFOTECHAHM;Initial Catalog=Hospital_data;Integrated Security=True;Pooling=False");
SqlDataAdapter da = new SqlDataAdapter("select PATIENT_ID from PATIENT ", con);
DataSet ds=new DataSet();
da.Fill(ds);
DropDownList2.DataSource = ds;
DropDownList2.DataValueField = "PATIENT_ID";
DropDownList2.DataTextField = "PATIENT_ID";
DropDownList2.DataBind();
|
|
|
|
|
string filename = "download\\bikes.dot";
if (filename != "")
{
string path = Server.MapPath(filename);
System.IO.FileInfo file = new System.IO.FileInfo(path);
if (file.Exists)
{
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);
Response.AddHeader("Content-Length", file.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.WriteFile(file.FullName);
Response.End();
}
else
{
Response.Write("This file does not exist.");
}
}
|
|
|
|
|
Textbox watermark Extender
<cc1:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender1" runat="server" TargetControlID ="TextBox1" WatermarkText ="Your Name" WatermarkCssClass ="Water">
</cc1:TextBoxWatermarkExtender>
ValidatorCalloutExtender
<cc1:ValidatorCalloutExtender ID="ValidatorCalloutExtender1" runat="server" TargetControlID="requiredfieldvalidater1" Width ="10px" HighlightCssClass="highlight" WarningIconImageUrl ="IMAGES/top01.jpg" CloseImageUrl ="IMAGES/title.jpg" >
</cc1:ValidatorCalloutExtender>
FilteredTextBoxExtender
(Get only lowercase character.)
<cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender1" runat="server" TargetControlID ="TextBox4" FilterType ="lowercaseLetters" FilterMode ="validChars" ValidChars="a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z" >
</cc1:FilteredTextBoxExtender>
(Get only number , and symbol.)
<cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender2" runat="server" TargetControlID ="TextBox5" FilterType ="Numbers, Custom" ValidChars="*-+/()." >
</cc1:FilteredTextBoxExtender>
(Get only Uppercase character.)
<cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender3" runat="server" TargetControlID ="TextBox6" FilterType ="uppercaseLetters" >
</cc1:FilteredTextBoxExtender>
CollapsiblePanelExtender
<cc1:CollapsiblePanelExtender ID="CollapsiblePanelExtender1" runat="server" TargetControlID ="Panel1" CollapsedSize ="0" ExpandedSize ="30" AutoCollapse ="False" AutoExpand ="false" Collapsed ="true" TextLabelID ="label1" CollapseControlID="LinkButton1" ExpandControlID ="LinkButton1" >
</cc1:CollapsiblePanelExtender>
CalendarExtender
<cc1:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID ="TextBox8" CssClass ="time" Format ="d-MM-yyyy" Animated="False">
</cc1:CalendarExtender>
DropShadowExtender
<cc1:DropShadowExtender ID="DropShadowExtender1" runat="server" TargetControlID ="Panel4" Opacity =".3" TrackPosition ="true" Rounded="true" Width="5" Radius="10" >
</cc1:DropShadowExtender>
DropDownExtender
<cc1:DropDownExtender ID="DropDownExtender1" runat="server" DynamicServiceMethod="GetDynamicContent" TargetControlID ="Label4" DropDownControlID ="DropDownList1">
</cc1:DropDownExtender>
ListSearchExtender
<cc1:ListSearchExtender ID="ListSearchExtender1" runat="server" TargetControlID ="ListBox1" PromptText ="Type Your Search Here" PromptCssClass ="listsearch" PromptPosition ="top" >
</cc1:ListSearchExtender>
HoverMenuExtender
<cc1:HoverMenuExtender ID="HoverMenuExtender1" runat="server" DynamicServiceMethod="GetDynamicContent2" TargetControlID="Panel5" PopupControlID ="popupmenu" HoverCssClass ="popuphover" PopupPosition ="left" OffsetX ="0" OffsetY ="0" PopDelay ="50" DynamicControlID ="Panel5">
</cc1:HoverMenuExtender>
|
|
|
|
|
<cc1:Accordion ID="Accordion1" runat="server" SelectedIndex ="-1" RequireOpenedPane ="false" FadeTransitions="true" AutoSize="none" TransitionDuration="100" FramesPerSecond ="30" SuppressHeaderPostbacks ="true" >
<Panes >
<cc1:AccordionPane runat ="server" ID ="AccordionPane1"><Header > <asp:LinkButton ID="LinkButton1" runat="server">My Name</asp:LinkButton></Header>
<Content >hjsghg fdhjkhd jhjkdd ddjhdd djkdhd ddjkbd dnbdjd dfbdjk</Content>
</cc1:AccordionPane>
<cc1:AccordionPane runat ="server" ID ="AccordionPane2"><Header > <asp:LinkButton ID="LinkButton2" runat="server">The Rock.</asp:LinkButton></Header>
<Content >Rock is wwe champain .</Content>
</cc1:AccordionPane>
<cc1:AccordionPane runat ="server" ID ="AccordionPane3"><Header > <asp:LinkButton ID="LinkButton3" runat="server">Infotech.</asp:LinkButton></Header>
<Content >Infotech is a software company in Ahmedbad .</Content>
</cc1:AccordionPane>
</Panes>
</cc1:Accordion>
|
|
|
|
|
SqlConnection con = new SqlConnection("Data Source=INFO\\TECHAHM;Initial Catalog=yahoo;Persist Security Info=True;User ID=sa; Password=sa");
SqlCommand cmd = new SqlCommand("select count(*) from login_table where login_ID='" + TextBox1.Text + "' and password='" + TextBox2.Text + "'", con);
cmd.Connection.Open();
string s1 = cmd.ExecuteScalar().ToString();
if (s1 != "0")
{
Session["login_ID"] = TextBox1.Text;
Response.Redirect("~/popat_marriage_bureau/Home.aspx");
}
else
{
Label1.Visible = true;
}
cmd.Connection.Close();
TextBox1.Text = "";
TextBox2.Text = "";
|
|
|
|