Soru & Cevap

"Tanınmayan atlatma sırası" hatası C# Visual Studi ...

27.04.2020 - 07:16

Bu benim frmMusteri.cs kodum : 

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 MarkePro
{
    public partial class frmMusteri : Form
    {
        public frmMusteri()
        {
            InitializeComponent();
        }
        SqlConnection connectSql = new SqlConnection("Data Source=.\SQLEXPRESS;Initial Catalog=MarkePro;Integrated Security=True");
        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void label5_Click(object sender, EventArgs e)
        {

        }

        private void btnMusteriEkle_Click(object sender, EventArgs e)
        {
            connectSql.Open();
            SqlCommand komut = new SqlCommand("insert into musteri(adSoyad) values(@adSoyad)", connectSql);
            komut.Parameters.AddWithValue("@adSoyad", txtMusteriAds.Text);
            komut.ExecuteNonQuery();
            connectSql.Close();
            MessageBox.Show("Müşteri Kaydı Eklendi!");
            foreach (Control item in this.Controls) 
            {
                if (item is TextBox)
                {
                    item.Text = "";
                }
            }
        }
    }
}

Bu da hata resmi

https://hizliresim.com/Bz2FAf

681 Görüntülenme

1 Cevap

Sitedeki sorulara cevap verebilmek için giriş yapın ya da üye olun.

Profile picture for user endustrimuh
endustrimuh
29.01.2021 - 09:51

connection string değerin yanlış olduğu için hata veriyor.

#c#