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
Ankita Ankita
NA
11
28k
Storing wrong value "System.data.datarowview" in table.
Feb 6 2012 7:18 AM
public void InsertSusCode()
{
for( i=0;i<lstcsuspectcode.SelectedItems.Count; i++)
{
if (con.State == ConnectionState.Closed)
{
con.Open();
}
string[] s = new string[lstcsuspectcode.SelectedItems.Count];
s[i]= lstcsuspectcode.SelectedItems[i].ToString();
string str="insert into casesuspect1(suspect_code) values('"+s[i]+"')";
SqlCommand cmd = new SqlCommand(str, con);
int r = cmd.ExecuteNonQuery();
if (r > 0)
{
MessageBox.Show("Suspect INSERTED SUCCESSFULLY.");
}
}
}
The above code stores value System.Data.DataRowView in the table casesuspect1? It should store the multiple selected items in list box. The suspectcode list box displays suspects name. So is there any mistake in the code? Any other suggesstion is also welcomed.
Reply
Answers (
1
)
Windows form upload file
Writing an ini file load routine in C#