You are given a database: C:test 2 mph and a database table: Employee - (Employe
ID: 3829581 • Letter: Y
Question
You are given a database: C:test 2 mph and a database table: Employee - (Employee). Employee Salary). For example, 1 10000 2 20000 Insert from a button directly, insert (3. 30000) into the above table. Write asp scripts to link your web page. Text2A aspx, to this database by using an object, Access Data Source. In the following three buttons, assume you have Access Data Source in you page. Test2A.aspx. which is already linked to the above table. Employee. Insert button - insert from two text boxes. Text Box 1 and TextBox2. Delete button - delete from Text Box. Update button - update from two text boxes. Text Box and TcxtBox2.Explanation / Answer
insert from directly::
insert into employee values(3,30000)
connection script::
var connection = new ActiveXObject("ADODB.Connection") ;
var connectionstring="Data Source=<server>;Initial Catalog=<catalog>;User ID=<user>;Password=<password>;Provider=SQLOLEDB";
connection.Open(connectionstring);
var rs = new ActiveXObject("ADODB.Recordset");
rs.Open("SELECT * FROM employee ", connection);
rs.MoveFirst
while(!rs.eof)
{
document.write(rs.fields(1));
rs.movenext;
}
rs.close;
connection.close;
insert two textbox::::
using (SqlConnection connection = new SqlConnection( "server=.;database=romesh;trusted_connection=true";)
{ con.Open();
string q = "select * from employee";
using (SqlCommand command = new SqlCommand(q, con)) {
using (SqlDataReader reader = command.ExecuteReader()){
while (reader.Read()){
int employeeid = TextBox1.Text;
int employee = TextBox1.Text;
Sql_Insert.Insert();
}}}}
Delete one text box
con.Open();
MySqlCommand cmd = new MySqlCommand("Delete From employee where colname=”columnname” );
cmd.ExecuteNonQuery();
cmd.Dispose();
update two text boxes::
con.open();
MySqlCommand cmd = new MySqlCommand("update employee Set coluname=updateemployeeid,employeesalary=updateemployeesalary where id=which id you want
cmd.ExecuteNonQuery();
cmd.Dispose();
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.