本文整理汇总了C#中Database.SelectDataFromDatabase方法的典型用法代码示例。如果您正苦于以下问题:C# Database.SelectDataFromDatabase方法的具体用法?C# Database.SelectDataFromDatabase怎么用?C# Database.SelectDataFromDatabase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Database
的用法示例。
在下文中一共展示了Database.SelectDataFromDatabase方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Button1_Click
protected void Button1_Click(object sender, EventArgs e)
{
//Label1.Text = textarea1.InnerText +syntax_selection.SelectedIndex.ToString() +syntax_selection.Value.ToString();
Label1.Text = textarea1.InnerText + syntax_selection.SelectedIndex.ToString() + syntax_selection.SelectedValue.ToString();
Database db = new Database();
MySqlDataReader rdr = null;
rdr = db.SelectDataFromDatabase("select ipaddress from compilertype where name='" + syntax_selection.SelectedValue.ToString() + "'");
if (rdr.HasRows)
{
if (rdr.Read())
{
type1ip = rdr.GetString(0);
}
}
//Label4.Text = "Your chose:" + DropDownList1.SelectedItem.Text + DropDownList1.SelectedIndex.ToString();
int i = 0;
i = db.InsertIntoDatabase("insert into crawler(prog,result,operation) values('" + textarea1.InnerText + "','0'," + (syntax_selection.SelectedIndex + 1).ToString() + ")");
DataSend ds = new DataSend(type1ip, "5212");
ds.sendData(" " + i.ToString());
id = i;
Button2.Visible = true;
}
示例2: Button2_Click
protected void Button2_Click(object sender, EventArgs e)
{
Database db = new Database();
MySqlDataReader rdr = db.SelectDataFromDatabase("select result from crawler where id=" + id);
Label1.Text = "select result from crawler where id=" + id;
if (rdr.HasRows)
{
if (rdr.Read())
{
textarea2.InnerText = rdr.GetString(0);
//Label1.Text = "Data Result" + rdr.GetString(0);
}
}
}
示例3: computeIt
void computeIt(String data)
{
Database db = new Database();
MySqlDataReader rdr=db.SelectDataFromDatabase("select prog,operation from crawler where id="+data);
if (rdr.HasRows)
{
if (rdr.Read())
{
if (rdr.GetInt32(1) == 1)
{
n.AddToTextBox("Data Retrived : " + rdr.GetString(0) + rdr.GetInt32(1));
//int res = rdr.GetInt32(0) + rdr.GetInt32(1);
String res=dojobC(rdr.GetString(0));
db.UpdateIntoDatabase("update crawler set result='" + res + "' where id=" + data);
}
if (rdr.GetInt32(1) == 2)
{
n.AddToTextBox("Data Retrived : " + rdr.GetString(0) + rdr.GetInt32(1));
//int res = rdr.GetInt32(0) - rdr.GetInt32(1);
String res = dojobJava(rdr.GetString(0));
n.AddToTextBox("Result"+res);
db.UpdateIntoDatabase("update crawler set result='" + res + "' where id=" + data);
}
if (rdr.GetInt32(1) == 3)
{
n.AddToTextBox("Data Retrived : " + rdr.GetInt32(0) + rdr.GetInt32(1));
//int res = rdr.GetInt32(0) * rdr.GetInt32(1);
String res = dojobC(rdr.GetString(0));
db.UpdateIntoDatabase("update crawler set result='" + res + "' where id=" + data);
}
if (rdr.GetInt32(1) == 4)
{
n.AddToTextBox("Data Retrived : " + rdr.GetInt32(0) + rdr.GetInt32(1));
//int res = rdr.GetInt32(0) / rdr.GetInt32(1);
String res = dojobC(rdr.GetString(0));
db.UpdateIntoDatabase("update crawler set result='" + res + "' where id=" + data);
}
else
{
n.AddToTextBox("not selected");
}
}
}
}
示例4: Button1_Click
protected void Button1_Click(object sender, EventArgs e)
{
Database db = new Database();
MySqlDataReader i = db.SelectDataFromDatabase("select id from compileruser where username='"+TextBox4.Text+"' and password='"+TextBox5.Text+"'");
if (i.HasRows)
{
if (i.Read())
{
Session["userid"] = i.GetInt32(0);
Response.Redirect("compiler.aspx");
}
else
{
Label1.Text = "login Unsuccessful";
}
}
}
示例5: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
syntax_selection.Items.Clear();
Button2.Visible = false;
Database db = new Database();
MySqlDataReader rdr = db.SelectDataFromDatabase("select name from compilertype");
if (rdr.HasRows)
{
while (rdr.Read())
{
//Label6.Text = "Data Result" + rdr.GetString(0);
//syntax_selection.Items.Add(rdr.GetString(0));
syntax_selection.Items.Add(rdr.GetString(0).ToString());
}
}
}
}
示例6: Button1_Click
protected void Button1_Click(object sender, EventArgs e)
{
Database db = new Database(this);
MySqlDataReader rdr = null;
rdr = db.SelectDataFromDatabase("select ipaddress from compilertype where name='" + DropDownList1.SelectedItem.Text + "'");
if (rdr.HasRows)
{
if (rdr.Read())
{
type1ip = rdr.GetString(0);
}
}
Label4.Text = "Your chose:" + DropDownList1.SelectedItem.Text+DropDownList1.SelectedIndex.ToString();
int i = 0;
i = db.InsertIntoDatabase("insert into crawler(prog,result,operation) values('" + TextBox1.Text + "','0'," + (DropDownList1.SelectedIndex+1).ToString() + ")");
DataSend ds = new DataSend(type1ip, "5212");
ds.sendData(" " + i.ToString());
id = i;
Button2.Visible = true;
/*
if (DropDownList1.SelectedItem.Text == "Sum")
{
rdr = db.SelectDataFromDatabase("select ipaddress from compilertype where name='Sum'");
if (rdr.HasRows)
{
if (rdr.Read())
{
//Label6.Text = "Data Result" + rdr.GetString(0);
//DropDownList1.Items.Add(rdr.GetString(0));
type1ip = rdr.GetString(0);
}
}
Label4.Text = "You choose:" + DropDownList1.SelectedItem.Text;
int i = 0;
i = db.InsertIntoDatabase("insert into crawler(prog,result,operation) values('" + TextBox1.Text + "','0',1)");
Label4.Text = "Not updated" + i;
DataSend ds = new DataSend(type1ip, "5212");
ds.sendData(" "+i.ToString());
id = i;
Button2.Visible = true;
}
if (DropDownList1.SelectedItem.Text == "Sub")
{
rdr = db.SelectDataFromDatabase("select ipaddress from compilertype where name='Sub'");
if (rdr.HasRows)
{
if (rdr.Read())
{
//Label6.Text = "Data Result" + rdr.GetString(0);
//DropDownList1.Items.Add(rdr.GetString(0));
type2ip = rdr.GetString(0);
}
}
Label4.Text = "You choose:" + DropDownList1.SelectedItem.Text;
int i = 0;
db = new Database(this);
//i = db.InsertIntoDatabase("insert into crawler(value1,value2,result,operation) values(" + TextBox1.Text + "," + TextBox2.Text + ",0,2)");
i = db.InsertIntoDatabase("insert into crawler(prog,result,operation) values('" + TextBox1.Text + "','0',2)");
Label4.Text = "Not updated" + i;
DataSend ds = new DataSend(type2ip, "5212");
ds.sendData(" " + i.ToString());
id = i;
Button2.Visible = true;
}
if (DropDownList1.SelectedItem.Text == "Multi")
{
rdr = db.SelectDataFromDatabase("select ipaddress from compilertype where name='Multi'");
if (rdr.HasRows)
{
if (rdr.Read())
{
//Label6.Text = "Data Result" + rdr.GetString(0);
//DropDownList1.Items.Add(rdr.GetString(0));
type3ip = rdr.GetString(0);
}
}
Label4.Text = "You choose:" + DropDownList1.SelectedItem.Text;
int i = 0;
db = new Database(this);
//i = db.InsertIntoDatabase("insert into crawler(value1,value2,result,operation) values(" + TextBox1.Text + "," + TextBox2.Text + ",0,3)");
i = db.InsertIntoDatabase("insert into crawler(prog,result,operation) values('" + TextBox1.Text + "','0',3)");
Label4.Text = "Not updated" + i;
//.........这里部分代码省略.........
示例7: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
Button2.Visible = false;
Database db = new Database(this);
MySqlDataReader rdr=db.SelectDataFromDatabase("select name from compilertype");
if (rdr.HasRows)
{
while (rdr.Read())
{
//Label6.Text = "Data Result" + rdr.GetString(0);
DropDownList1.Items.Add(rdr.GetString(0));
}
}
}