- Katılım
- 5 Nisan 2020
- Mesajlar
- 2.816
- Çözümler
- 11
Daha fazla
- Cinsiyet
- Erkek
- Meslek
- Sivil Polis
C#:
using System;
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;
namespace UrunTanılamaSistemi
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} SqlConnection baglanti = new SqlConnection("Data Source=DESKTOP-0P271D8\\SQLEXPRESS;Initial Catalog=UrunInfo;Integrated Security=True");
private void urunlistesi()
{
baglanti.Open();
SqlCommand cmd = new SqlCommand("select * from Urun", baglanti);
SqlDataReader RD = cmd.ExecuteReader();
while (RD.Read())
{
ListViewItem listele = new ListViewItem();
listele.Text = (RD["urunadi"].ToString());
listele.SubItems.Add(RD["urunbarkodu"].ToString());
listele.SubItems.Add(RD["urunfiyati"].ToString());
listView1.Items.Add(listele);
}baglanti.Close();
}
private void button1_Click(object sender, EventArgs e)
{
urunlistesi();
}
private void button2_Click(object sender, EventArgs e)
{
baglanti.Open();
SqlCommand komut = new SqlCommand("insert into ('" + textBox1.Text.ToString() + "','" + textBox2.Text.ToString() + "','" + textBox3.Text.ToString() + "')",baglanti);
komut.ExecuteNonQuery();
MessageBox.Show("Kaydedildi", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Information);
baglanti.Close();
urunlistesi();
}
}
}
Son düzenleyen: Moderatör: