function disable()
{
// alert('asdfgsjf');
if(event.button==2)
{
alert('Right click disabled ');
return false;
}
}
{
// alert('asdfgsjf');
if(event.button==2)
{
alert('Right click disabled ');
return false;
}
}
import java.sql.*;
public class insertTableData
{
public static void main(String[] args)
{
DB db = new DB();
Connection conn=db.dbConnect(
"jdbc:jtds:sqlserver://localhost:1433/tempdb","sa","");
db.insertData(conn);
}
}
class DB
{
public DB() {}
public Connection dbConnect(String db_connect_string,
String db_userid,String db_password)
{
try
{
Class.forName("net.sourceforge.jtds.jdbc.Driver");
Connection conn = DriverManager.getConnection(
db_connect_string,db_userid,db_password);
System.out.println("connected");
return conn;
}
catch (Exception e)
{
e.printStackTrace();
return null;
}
}
public void insertData(Connection conn)
{
Statement stmt;
try
{
stmt = conn.createStatement();
stmt.executeUpdate("insert into cust_profile " +
"values('name1', 'add1','city1','state1','country1')");
stmt.executeUpdate("insert into cust_profile " +
"values('name2', 'add2','city2','state2','country2')");
stmt.executeUpdate("insert into cust_profile " +
"values('name3', 'add3','city3','state3','country3')");
stmt.close();
conn.close();
}
catch (Exception e)
{
e.printStackTrace();
}
}
};
http://www.java-tips.org/other-api-tips/jdbc/how-to-insert-data-into-database-tables-with-the-help-of-2.html
We have three types of Joins in sql.
They are
1. Inner join
2. Outer join
3. Cross join
1. Inner join:
Inner join is the default type of join, it will producesses the result set, which contains matched rows only.
Syntax: select * from table1<innerjoin>table2
Here noneed of specifying innerjoin. Simply we can specify Join also.
Syntax: select * from table1<join>table2
2. Outer join:
Outer join produces the results, which contains matched rows and unmatched rows.
Outer join is further classified as three types.They are
A. left outer join
B. right outer join
C. full outer join.
A. Left outer join:
Left outer join producesses the results, which contains all the rows from left table and matched rows from right table.
Syntax: select * from table1<leftouterjoin>table2
B. Right outer join:
Right outer join producesses the resultset, which contains all the rows from right table and matched rows from left table.
Syntax:select * from table1<right outer join>table2
C. Full outer join:
Full outer join producesses the resultset, which contains all the rows from left table and all the rows from right table.
Syntax:select * from table1<fullouterjoin>table2
3.Cross join:
A join without having any condition is known as cross join, in cross join every row in first table is joins with every row in second table. Cross join is nothing but cortizion product.
Syntax: select * from table1<cross join>table2
Self join:
A join joins withitself is called self join working with self joins we use alias tables.
<HTML>
<HEAD>
<TITLE>Letting Only Numbers Pass to a Form Field</TITLE>
<SCRIPT LANGUAGE="JavaScript">
function checkIt(evt) {
evt = (evt) ? evt : window.event
var charCode = (evt.which) ? evt.which : evt.keyCode
if (charCode > 31 && (charCode < 48 || charCode > 57)) {
status = "This field accepts numbers only."
return false
}
status = ""
return true
}
</SCRIPT>
</HEAD>
<BODY>
<H1>Letting Only Numbers Pass to a Form Field</H1>
<HR>
<FORM onSubmit="return false">
Enter any positive integer: <INPUT TYPE="text" NAME="numeric"
onKeyPress="return checkIt(event)">
</FORM>
</BODY>
</HTML>
//insert data to xml file Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Dim xmldoc As XmlDocument = New XmlDocument() xmldoc.Load(Server.MapPath("App_Data\smallfools.xml")) Dim newelement As XmlElement = xmldoc.CreateElement("poems") Dim xmlAuthor As XmlElement = xmldoc.CreateElement("author") Dim xmlTitle As XmlElement = xmldoc.CreateElement("title") Dim xmlContent As XmlElement = xmldoc.CreateElement("content") xmlAuthor.InnerText = Me.TextBox1.Text.Trim() xmlTitle.InnerText = Me.TextBox2.Text.Trim() xmlContent.InnerText = Me.TextBox3.Text.Trim() newelement.AppendChild(xmlAuthor) newelement.AppendChild(xmlTitle) newelement.AppendChild(xmlContent) xmldoc.DocumentElement.AppendChild(newelement) xmldoc.Save(Server.MapPath("App_Data\smallfools.xml")) loadXmlData() End Sub //modify one xml data base on selecteditem Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click Dim xmldoc As XmlDocument = New XmlDocument() xmldoc.Load(Server.MapPath("App_Data\smallfools.xml")) If Int32.Parse(Me.lblSelectIndex.Text) = -1 Then Me.RegisterClientScriptBlock("alertmessage", "<script>alert('please select one modify data item.')</script>") Else Dim xmlnode As XmlNode = xmldoc.DocumentElement.ChildNodes.Item(Int32.Parse(Me.lblSelectIndex.Text)) xmlnode("author").InnerText = Me.TextBox1.Text.Trim() xmlnode("title").InnerText = Me.TextBox2.Text.Trim() xmlnode("content").InnerText = Me.TextBox3.Text.Trim() xmldoc.Save(Server.MapPath("App_Data\smallfools.xml")) End If loadXmlData() End Sub //Delete one xml data base on selecteditem Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click Dim xmldoc As XmlDocument = New XmlDocument() xmldoc.Load(Server.MapPath("App_Data\smallfools.xml")) Dim xmlnode As XmlNode = xmldoc.DocumentElement.ChildNodes.Item(Int32.Parse(Me.lblSelectIndex.Text)) xmlnode.ParentNode.RemoveChild(xmlnode) xmldoc.Save(Server.MapPath("App_Data\smallfools.xml")) loadXmlData() Me.TextBox1.Text = "" Me.TextBox2.Text = "" Me.TextBox3.Text = "" End Sub //clear textbox value Protected Sub Button4_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button4.Click Me.TextBox1.Text = "" Me.TextBox2.Text = "" Me.TextBox3.Text = "" End Sub //load xml data from xml file Private Sub loadXmlData() Dim myDs As DataSet = New DataSet() myDs.ReadXml(Server.MapPath("App_Data\smallfools.xml")) If myDs.Tables.Count <> 0 Then Me.GridView1.DataSource = myDs Me.GridView1.DataBind() End If End Sub //select one data and fill data to textbox Private Sub FindXmlData(ByVal selectedIndex As Integer) Dim xmldoc As XmlDocument = New XmlDocument() xmldoc.Load(Server.MapPath("App_Data\smallfools.xml")) Dim xmlnodelist As XmlNodeList = xmldoc.DocumentElement.ChildNodes Dim xmlnode As XmlNode = xmlnodelist.Item(selectedIndex) Me.textBox1.Text = xmlnode("author").InnerText Me.textBox2.Text = xmlnode("title").InnerText Me.textBox3.Text = xmlnode("content").InnerText End Sub |
// Load the list box with the four UI mode options. uiModeOptions.Items.Add("invisible"); uiModeOptions.Items.Add("none"); uiModeOptions.Items.Add("mini"); uiModeOptions.Items.Add("full"); private void uiModeOptions_OnSelectedIndexChanged(object sender, System.EventArgs e) { // Get the selected UI mode in the list box as a string. string newMode = (string)(((System.Windows.Forms.ListBox)sender).SelectedItem); // Set the UI mode that the user selected. player.uiMode = newMode;
}
private void fullScreen_Click(object sender, System.EventArgs e) { // If the player is playing, switch to full screen. if (player.playState == WMPLib.WMPPlayState.wmppsPlaying) { player.fullScreen = true; } }
how to implement 3-tier architecture in asp.net using c#. 3-Tier architecture is also called layered architecture. Some people called it ...