using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace _20090107_BCS_資料庫_表單模式_
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
//單獨撈的時候
private void button1_Click(object sender, EventArgs e)
{
using (SqlConnection aaa = new SqlConnection("Data Source=10.1.1.253;Initial Catalog=BCS;User ID=sa;Password=fuchi4728")) //開啟連線
{
//做之前清資料
int dd_count = 0;
listBox1.Items.Clear();
aaa.Open(); //打開
SqlCommand ss = new SqlCommand("SELECT * FROM IWK_ACT WHERE S_NO='FT5508A08C0188U2426503'", aaa); //命令
SqlDataReader dd = ss.ExecuteReader(); //讀取
while (dd.Read())
{
listBox1.Items.Add(dd["S_NO"] + " " + dd["FUNCTION_"]);
dd_count++;
}
MessageBox.Show("查詢完了");
label1.Text = dd_count.ToString();
}
}
}
}
沒有留言:
張貼留言