15,797,330 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Python questions
View PHP questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by SuperJWP (Top 3 by date)
SuperJWP
6-May-20 10:03am
View
The employee use multiple applications, therefore, i cannot create multiple rows for one user with all relevant applications the employee use.
SuperJWP
29-Apr-20 12:34pm
View
What do you mean, can you be more clearer please
SuperJWP
30-Nov-18 2:25am
View
I am having issues with my code , when i submit the data
using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Linq;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Configuration;
using System.Dynamic;
using System.Data.SqlClient;
using System.Data;
public partial class NewEmployeeRequestForm : System.Web.UI.Page
{
SqlCommand cmd = new SqlCommand();
SqlConnection conn = new SqlConnection();
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(@"Data Source=SH-JASONK\DEV;Initial Catalog=EmployeeRegistration;Integrated Security=True");
{
con.Open();
SqlCommand cmd = new SqlCommand("insert into Employees values(@FirstName, @LastName, @Email, @Gender, @Phone, @StartDate, @Company, @Department, @Applications, @Requestedby)", con);
cmd.Parameters.AddWithValue("@FirstName", FirstName.Text);
cmd.Parameters.AddWithValue("@LastName", LastName.Text);
cmd.Parameters.AddWithValue("@Email", Email.Text);
cmd.Parameters.AddWithValue("@Gender", RadioButtonList1.SelectedValue);
cmd.Parameters.AddWithValue("@Phone", Phone.Text);
cmd.Parameters.AddWithValue("@StartDate", StartDate.Text);
cmd.Parameters.AddWithValue("@Company", Company.SelectedValue);
cmd.Parameters.AddWithValue("@Department", Departments.SelectedValue);
cmd.Parameters.AddWithValue("@Applicatons", CheckBoxList1.SelectedValue);
cmd.Parameters.AddWithValue("@Devices", RadioButtonList.SelectedValue);
cmd.ExecuteNonQuery();
con.Close();
}
}
}
The Error i receive is :
Must declare the scalar variable "@Applications".
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Must declare the scalar variable "@Applications".
Source Error:
Line 42: cmd.Parameters.AddWithValue("@Applicatons", CheckBoxList1.SelectedValue);
Line 43: cmd.Parameters.AddWithValue("@Devices", RadioButtonList.SelectedValue);
Line 44: cmd.ExecuteNonQuery();
Line 45: con.Close();
Line 46: