TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Cj Mah
NA
0
2k
i need help in editresource code
Dec 28 2015 11:54 PM
i want to used it for my project but the problem is this code, the error message is invalid column name "Type".
int id = 0;
SqlConnection conn = null;
SqlCommand cmd = null;
string connectionString = null;
protected void btnSubmit_Click(object sender, EventArgs e)
{
connectionString = ConfigurationManager.ConnectionStrings["FacilityCS"].ConnectionString;
conn = new SqlConnection(connectionString);
string sql = "UPDATE Resource SET Type=@type, Description=@description, Location=@location,";
sql+=" Abr=@abr, Description=@description, Capacity=@capacity, Details=@details, Level=@level From";
sql += " Resource INNER JOIN ResourceType ON ResourceType.Id=ResourceType.Id";
sql += " WHERE Resource.Id=@id";
try
{
cmd = new SqlCommand(sql, conn);
cmd.Parameters.AddWithValue("@type", Convert.ToInt32(ddlType.SelectedValue));
cmd.Parameters.AddWithValue("@description", tbDescription.Text);
cmd.Parameters.AddWithValue("@location", tbLocation.Text);
cmd.Parameters.AddWithValue("@abr", tbAbr.Text);
cmd.Parameters.AddWithValue("@details", tbDetails.Text);
cmd.Parameters.AddWithValue("@capacity", tbCapacity.Text);
cmd.Parameters.AddWithValue("@level", tbLevel.Text);
cmd.Parameters.AddWithValue("@id", lblIdOut.Text);
conn.Open();
int row = cmd.ExecuteNonQuery();
if(row>0)
{
lblOutput.Text = "Record Updated successfully";
}
}
Reply
Answers (
3
)
Telerik radgrid with checkbox
How to search a text file in a folder?