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 WindowsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { using (SqlConnection connection = new SqlConnection("user id=mike69; pwd=2039; server=HERMON; database=mjmay-targil")) { textBox2.Text = ""; connection.Open(); SqlDataReader reader = null; SqlCommand command = new SqlCommand(textBox1.Text, connection); reader = command.ExecuteReader(); while (reader.Read()) { for (int i = 0; i < reader.FieldCount; i++) { textBox2.Text += reader[i] + " "; } textBox2.Text += Environment.NewLine; } } } } }