TextBox olan parametre değeri String değerine dönüştürülemedi.

Alp Koşucu 21 Reputation points
2022-10-03T07:58:19.74+00:00

SqlConnection con = new SqlConnection();
SqlCommand cmd = new SqlCommand();

        con.Open();  
        cmd.Connection = con;  
        cmd.CommandType = CommandType.StoredProcedure;  
        cmd.CommandText = "sp_Malzeme_Kayıt_Güncelleme";  
        cmd.Parameters.Add("@MALZEMEKODU", SqlDbType.VarChar, 8).Value = tbMalzemekodu.Text;   
        cmd.Parameters.Add("@BIRIM", SqlDbType.VarChar, 5).Value = tbBirim.Text;   
        cmd.Parameters.Add("@DESENNO", SqlDbType.VarChar, 30).Value = tbDesenNo.Text;  
        cmd.Parameters.Add("@DENEMENO", SqlDbType.VarChar, 30).Value = tbDenemeNo.Text;  
        cmd.Parameters.Add("@EBAT", SqlDbType.VarChar, 30).Value = tbEbat.Text;  
        cmd.Parameters.Add("@RENK", SqlDbType.VarChar, 30).Value = tbRenk.Text;  
        cmd.Parameters.Add("@IPLIK", SqlDbType.VarChar, 30).Value = tbİplik.Text;  
        cmd.Parameters.Add("@TUSE", SqlDbType.VarChar, 30).Value = tbTuşe;  
        cmd.ExecuteNonQuery();  
        con.Close();  

bu şekilde bir kod yazdım ama (TextBox olan parametre değeri String değerine dönüştürülemedi.'
) bu hatayı alıyorum ne yapmam gerekli

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,841 questions
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,818 questions
0 comments No comments
{count} votes

Accepted answer
  1. Jiale Xue - MSFT 34,356 Reputation points Microsoft Vendor
    2022-10-03T09:22:09.267+00:00

    Hi @Alp Koşucu ,Welcome to Q&A.

    This is an English forum, please revise your question in English.

    Your problem may be caused by this line.

    cmd.Parameters.Add("@TUSE", SqlDbType.VarChar, 30).Value = tbTuşe;  
    

    Please change "tbTuşe" to "tbTuşe.text".

    Best Regards,
    Jiale


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful