Click here to Skip to main content
15,892,927 members
Home / Discussions / C#
   

C#

 
Questionforeach loop behavior C# Pin
picasso22-Mar-20 18:55
picasso22-Mar-20 18:55 
AnswerRe: foreach loop behavior C# Pin
Pete O'Hanlon2-Mar-20 20:17
mvePete O'Hanlon2-Mar-20 20:17 
AnswerRe: foreach loop behavior C# Pin
OriginalGriff2-Mar-20 20:23
mveOriginalGriff2-Mar-20 20:23 
AnswerRe: foreach loop behavior C# Pin
lmoelleb3-Mar-20 23:01
lmoelleb3-Mar-20 23:01 
QuestionIgroupping with Parallel Pin
Member 110035101-Mar-20 6:58
Member 110035101-Mar-20 6:58 
AnswerRe: Igroupping with Parallel Pin
Dave Kreskowiak1-Mar-20 7:39
mveDave Kreskowiak1-Mar-20 7:39 
GeneralRe: Igroupping with Parallel Pin
Member 110035101-Mar-20 7:46
Member 110035101-Mar-20 7:46 
GeneralRe: Igroupping with Parallel Pin
Dave Kreskowiak1-Mar-20 7:50
mveDave Kreskowiak1-Mar-20 7:50 
GeneralRe: Igroupping with Parallel Pin
Member 110035101-Mar-20 18:28
Member 110035101-Mar-20 18:28 
AnswerRe: Igroupping with Parallel Pin
Luc Pattyn1-Mar-20 9:04
sitebuilderLuc Pattyn1-Mar-20 9:04 
GeneralRe: Igroupping with Parallel Pin
Member 110035101-Mar-20 18:36
Member 110035101-Mar-20 18:36 
GeneralRe: Igroupping with Parallel Pin
Pete O'Hanlon1-Mar-20 21:21
mvePete O'Hanlon1-Mar-20 21:21 
GeneralRe: Igroupping with Parallel Pin
Member 110035101-Mar-20 22:17
Member 110035101-Mar-20 22:17 
GeneralRe: Igroupping with Parallel Pin
Pete O'Hanlon1-Mar-20 22:42
mvePete O'Hanlon1-Mar-20 22:42 
GeneralRe: Igroupping with Parallel Pin
Richard Deeming1-Mar-20 23:57
mveRichard Deeming1-Mar-20 23:57 
Generaladd DISTINCT drop PARALLEL Pin
Luc Pattyn2-Mar-20 0:48
sitebuilderLuc Pattyn2-Mar-20 0:48 
Generaldrop TOLIST, avoid memory stress Pin
Luc Pattyn2-Mar-20 9:13
sitebuilderLuc Pattyn2-Mar-20 9:13 
AnswerRe: Igroupping with Parallel Pin
Eddy Vluggen1-Mar-20 13:47
professionalEddy Vluggen1-Mar-20 13:47 
GeneralRe: Igroupping with Parallel Pin
Member 110035101-Mar-20 22:18
Member 110035101-Mar-20 22:18 
QuestionError must declare scalar variable @ISBN update statement c# Pin
Member 1164145429-Feb-20 5:20
Member 1164145429-Feb-20 5:20 
working on my project, I have encountered an error,"must declare scalar variable @ISBN". Please advise on where am going wrong.
Here is my code below:

try
           {


               //update button
               string cmd_query = "UPDATE [book_tbl] SET [Type_ID] = '@cmbtyp',[category] ='@cmbcat',[title] ='@title',[publisher_ID] ='@cmbpub', [A_ID] ='@cmbauthor',[first_name] ='@fname',[last_name]='@lname',[publication] ='@pub' where [ISBN] =@isbn";

               //parameters

               cmd.Parameters.AddWithValue("@cmbtyp", SqlDbType.Int).Value =cmbtyp.Text;
               cmd.Parameters.AddWithValue("@cmbcat", SqlDbType.VarChar).Value = cmbcat.Text;
               cmd.Parameters.AddWithValue("@title", SqlDbType.VarChar).Value = txtTitle.Text;
               cmd.Parameters.AddWithValue("@cmbpub", SqlDbType.Int).Value = cmbpub.Text;
               cmd.Parameters.AddWithValue("@cmbauthor", SqlDbType.Int).Value = cmbauthor.Text;
               cmd.Parameters.AddWithValue("@fname", SqlDbType.VarChar).Value = txtfname.Text;
               cmd.Parameters.AddWithValue("@lname", SqlDbType.VarChar).Value = txtlname.Text;
               cmd.Parameters.AddWithValue("@pub", SqlDbType.VarChar).Value = txtpub.Text;
               cmd.Parameters.AddWithValue("@isbn", SqlDbType.Int).Value=txtISBN.Text;
               con = new SqlConnection(ConnectionString);
               con.Open();
               //cmd = new SqlCommand();
               cmd = con.CreateCommand();
               cmd.CommandType = CommandType.Text;
               cmd.CommandText = cmd_query;
               cmd.ExecuteNonQuery();
               con.Close();

               MessageBox.Show("record updated successfully");
               //reset controls
               clear();
           }
           catch (Exception ex)
           {
               MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
           }

AnswerRe: Error must declare scalar variable @ISBN update statement c# Pin
OriginalGriff29-Feb-20 5:38
mveOriginalGriff29-Feb-20 5:38 
GeneralRe: Error must declare scalar variable @ISBN update statement c# Pin
Member 1164145429-Feb-20 22:20
Member 1164145429-Feb-20 22:20 
GeneralRe: Error must declare scalar variable @ISBN update statement c# Pin
OriginalGriff29-Feb-20 22:42
mveOriginalGriff29-Feb-20 22:42 
GeneralRe: Error must declare scalar variable @ISBN update statement c# Pin
phil.o29-Feb-20 22:44
professionalphil.o29-Feb-20 22:44 
QuestionESENTUTL in C# Pin
colins528629-Feb-20 4:28
colins528629-Feb-20 4:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.