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.SqlClient;
namespace Examples
{
public partial class SysObjects : Form
{
public SysObjects()
{
InitializeComponent();
}
SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=jQuery;UID=sa;password=tiger123");
SqlCommand cmd;
private void button1_Click(object sender, EventArgs e)
{
try
{
con.Open();
cmd = new SqlCommand(richTextBox1.Text,con);
SqlDataReader dr = cmd.ExecuteReader();
if (dr.Read())
{
DataTable dt = new DataTable();
dt.Load(dr);
dataGrid1.DataSource = dt;
}
}
catch (Exception ex)
{
}
}
}
}
No comments:
Post a Comment