Professional Documents
Culture Documents
User
User
User
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
namespace supermarket
{
public partial class FormSeller : Form
{
//koneksi database
SqlConnection conn = new SqlConnection("Data Source=DESKTOP-V6TQFSL\\SQLEXPRESS;Initial
Catalog=DBSUPERMARKETMB;Integrated Security=True");
public FormSeller()
{
InitializeComponent();
KondisiAwal();
}
void KondisiAwal()
{
conn.Open();
string query = "select * from tb_Seller";
SqlDataAdapter da = new SqlDataAdapter(query, conn);
SqlCommandBuilder scbul = new SqlCommandBuilder(da);
var ds = new DataSet();
da.Fill(ds);
dataGridView1.DataSource = ds.Tables[0];
conn.Close();
bersih();
}
void bersih()
{
textBox1.Text = "";
textBox2.Text = "";
textBox3.Text = "";
textBox4.Text = "";
textBox5.Text = "";
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
catch (Exception x)
{
MessageBox.Show(x.ToString());
}
}
}
catch (Exception x)
{
MessageBox.Show(x.ToString());
}
}