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
Zakir Ahamed
NA
1.4k
630.7k
my connection string is not working
Jul 21 2017 3:16 AM
this my code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Collections;
using Sample;
if (txtcategory.Text != " ")
{
try
{
ConnectionString
con = ConfigurationManager.ConnectionStrings["RetailTestConnection"].ToString();
con.Open();
string query = String.Format("Select [Item_Id]='{0}' order by Item_Id", txtcategory.Text);
SqlCommand cmd = new SqlCommand(query, con);
SqlDataReader dr = cmd.ExecuteReader();
string[] s = new string[] { };
while (dr.Read())
{
s = dr["Items"].ToString().Split(',');
}
int Length = s.Length;
for (int i = 0; i < Length - 1; i++)
// for (int i = 0; i <= 1; i++)
{
string fetr = s[i];
for (int j = 0; j <= clbbrand.Items.Count - 1; j++)
{
if (clbbrand.Items[j].ToString() == s[i])
{
clbbrand.SetItemChecked(j, true);
break;
}
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
}
else
{
// Message.Show("Please Eneter Your Choice");
}
note error:
the type or namespace name 'Connection string' could not be found
Reply
Answers (
2
)
Previous version of application is not removed in c#
i need to check Multicheckedlistbox with checked items