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 stp
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("Data Source=.\\SQLEXPRESS;Initial Catalog=ex;Integrated Security=True;Pooling=False");
SqlCommand sqlcmd = new SqlCommand("dbo.AddUser", con);
sqlcmd.CommandType = CommandType.StoredProcedure;
sqlcmd.Parameters.AddWithValue("@Username", textBox1.Text);
sqlcmd.Parameters.AddWithValue("@Password", textBox2.Text);
try
{
con.Open();
sqlcmd.ExecuteNonQuery();
}
catch (Exception ee)
{
MessageBox.Show(ee.Message.ToString());
}
finally
{
con.Close();
/*
ochcharai neda?
*
*/
}
}
}
}
this is the code that i have made using stored procedure to add to text box values to a database.And now i need to retreav them one by one .(it means in a another form if i enter the user name and pres a button i must get the user name and the password to another new 2 texboxes)thanx