۲۵-تير-۱۳۹۱, ۱۱:۱۸:۰۷
سلام
این کد چه مشکلی داره که search دفترچه تلفن وقتی روی دکمه search کلیک میکنیم جوابی نمی ده؟
فرم تشکیل شده از دکمه search و یک datagridviewو یک textbox
وdatabaseهم دارای name,family,tell,id می باشد
این کد چه مشکلی داره که search دفترچه تلفن وقتی روی دکمه search کلیک میکنیم جوابی نمی ده؟
فرم تشکیل شده از دکمه search و یک datagridviewو یک textbox
وdatabaseهم دارای name,family,tell,id می باشد
کد:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Data.SqlTypes;
namespace WindowsFormsApplication5
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
dbConnect dbc = new dbConnect();
string s = " ";
if (radioButton1.Checked == true)
{
s = string.Format("select * from tell where name='{0}%'", textBox1.Text);
}
else
{
if (radioButton2.Checked == true)
{
s = string.Format("select * from tell where family='{0}%'", textBox1.Text);
}
else
{
if (radioButton3.Checked == true)
{
s = string.Format("select * from tell where tell='{0}%'", textBox1.Text);
}
}dataGridView1.DataSource = dbc.selectcmd(s);
if (dbc.lasterror != null)
{
MessageBox.Show(dbc.lasterror);
}
}
}
private void Form1_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'dbsearchDataSet.tell' table. You can move, or remove it, as needed.
this.tellTableAdapter.Fill(this.dbsearchDataSet.tell);
}
}
}