16,007,687 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 Visual Basic questions
View .NET 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 akminder (Top 6 by date)
akminder
24-Feb-12 2:51am
View
<pre lang="c#"> SqlConnection con;
// SqlCommand com;
String message;
con = new SqlConnection(@"Data Source=AKMINDER-PC\SQLEXPRESS;Initial Catalog=elin appliances(Comaker of PHILIPS);Integrated Security=true");
SqlCommand com = new SqlCommand();
message = "Select product_id, product_name from product_info";
con.Open();
DataSet DS = new DataSet();
SqlDataAdapter DA = new SqlDataAdapter();
DA.SelectCommand = new SqlCommand(message, con);
// com.ExecuteNonQuery();
DA.Fill(DS);
con.Close();
if (DS.Tables[0].Rows.Count > 0)
{
combo1.DataSource = DS.Tables[0];
combo1.DisplayMember = "product_name";
combo1.ValueMember = "product_id";
//combo1.Items.Insert(0, "--Select--");
}
else
{
lblMsg.Text = "No product found";
}
}
private void fillrawmaterialid(string proid)
{
SqlConnection con;
// SqlCommand com;
// String message;
con=new SqlConnection(@"Data Source=AKMINDER-PC\SQLEXPRESS;Initial Catalog=elin appliances(Comaker of PHILIPS);Integrated Security=true");
SqlCommand com = new SqlCommand();
//message = "Select Raw_Material_ID ,Raw_Material from Raw_Info where product_id='"+combo1.SelectedIndex+"'";
com.Connection = con;
com.CommandText = "Select Raw_Material_ID ,Raw_Material from Raw_Info where product_id='" + proid + "'";
com.Parameters.AddWithValue("@proid", proid);
DataSet DS = new DataSet();
SqlDataAdapter DA = new SqlDataAdapter();
DA.SelectCommand = com;
con.Open();
// com.ExecuteNonQuery();
DA.Fill(DS);
con.Close();
if (DS.Tables[0].Rows.Count > 0)
{
comborawid.DataSource = DS.Tables[0];
comborawid.DisplayMember = "Raw_Material";
comborawid.ValueMember = "Raw_Material_ID";
//combo1.Items.Insert(0, "--Select--");
}
else
{
lblMsg.Text = "No product found";
}
private void combo1_SelectedIndexChanged(object sender, EventArgs e)
{
string proid=(combo1.SelectedIndex.ToString());
fillrawmaterialid(proid);
}</pre>
Now with valuemember and Display member i am getting values in combo1 but i also want the list of raw material corressponding to selected index of Combo1 in cborawmaterial.
e.g if I select Product laptop in combo1_SelectedIndexChanged then only I should get specific raw material related to laptop not all rawmaterials which is stored in database
but i am getting whole list of raw material
do tell me about select query ...what change is need?
akminder
24-Feb-12 2:51am
View
<pre lang="c#"> SqlConnection con;
// SqlCommand com;
String message;
con = new SqlConnection(@"Data Source=AKMINDER-PC\SQLEXPRESS;Initial Catalog=elin appliances(Comaker of PHILIPS);Integrated Security=true");
SqlCommand com = new SqlCommand();
message = "Select product_id, product_name from product_info";
con.Open();
DataSet DS = new DataSet();
SqlDataAdapter DA = new SqlDataAdapter();
DA.SelectCommand = new SqlCommand(message, con);
// com.ExecuteNonQuery();
DA.Fill(DS);
con.Close();
if (DS.Tables[0].Rows.Count > 0)
{
combo1.DataSource = DS.Tables[0];
combo1.DisplayMember = "product_name";
combo1.ValueMember = "product_id";
//combo1.Items.Insert(0, "--Select--");
}
else
{
lblMsg.Text = "No product found";
}
}
private void fillrawmaterialid(string proid)
{
SqlConnection con;
// SqlCommand com;
// String message;
con=new SqlConnection(@"Data Source=AKMINDER-PC\SQLEXPRESS;Initial Catalog=elin appliances(Comaker of PHILIPS);Integrated Security=true");
SqlCommand com = new SqlCommand();
//message = "Select Raw_Material_ID ,Raw_Material from Raw_Info where product_id='"+combo1.SelectedIndex+"'";
com.Connection = con;
com.CommandText = "Select Raw_Material_ID ,Raw_Material from Raw_Info where product_id='" + proid + "'";
com.Parameters.AddWithValue("@proid", proid);
DataSet DS = new DataSet();
SqlDataAdapter DA = new SqlDataAdapter();
DA.SelectCommand = com;
con.Open();
// com.ExecuteNonQuery();
DA.Fill(DS);
con.Close();
if (DS.Tables[0].Rows.Count > 0)
{
comborawid.DataSource = DS.Tables[0];
comborawid.DisplayMember = "Raw_Material";
comborawid.ValueMember = "Raw_Material_ID";
//combo1.Items.Insert(0, "--Select--");
}
else
{
lblMsg.Text = "No product found";
}
private void combo1_SelectedIndexChanged(object sender, EventArgs e)
{
string proid=(combo1.SelectedIndex.ToString());
fillrawmaterialid(proid);
}</pre>
Now with valuemember and Display member i am getting values in combo1 but i also want the list of raw material corressponding to selected index of Combo1 in cborawmaterial.
e.g if I select Product laptop in combo1_SelectedIndexChanged then only I should get specific raw material related to laptop not all rawmaterials which is stored in database
but i am getting whole list of raw material
do tell me about select query ...what change is need?
akminder
24-Feb-12 2:51am
View
<pre lang="c#"> SqlConnection con;
// SqlCommand com;
String message;
con = new SqlConnection(@"Data Source=AKMINDER-PC\SQLEXPRESS;Initial Catalog=elin appliances(Comaker of PHILIPS);Integrated Security=true");
SqlCommand com = new SqlCommand();
message = "Select product_id, product_name from product_info";
con.Open();
DataSet DS = new DataSet();
SqlDataAdapter DA = new SqlDataAdapter();
DA.SelectCommand = new SqlCommand(message, con);
// com.ExecuteNonQuery();
DA.Fill(DS);
con.Close();
if (DS.Tables[0].Rows.Count > 0)
{
combo1.DataSource = DS.Tables[0];
combo1.DisplayMember = "product_name";
combo1.ValueMember = "product_id";
//combo1.Items.Insert(0, "--Select--");
}
else
{
lblMsg.Text = "No product found";
}
}
private void fillrawmaterialid(string proid)
{
SqlConnection con;
// SqlCommand com;
// String message;
con=new SqlConnection(@"Data Source=AKMINDER-PC\SQLEXPRESS;Initial Catalog=elin appliances(Comaker of PHILIPS);Integrated Security=true");
SqlCommand com = new SqlCommand();
//message = "Select Raw_Material_ID ,Raw_Material from Raw_Info where product_id='"+combo1.SelectedIndex+"'";
com.Connection = con;
com.CommandText = "Select Raw_Material_ID ,Raw_Material from Raw_Info where product_id='" + proid + "'";
com.Parameters.AddWithValue("@proid", proid);
DataSet DS = new DataSet();
SqlDataAdapter DA = new SqlDataAdapter();
DA.SelectCommand = com;
con.Open();
// com.ExecuteNonQuery();
DA.Fill(DS);
con.Close();
if (DS.Tables[0].Rows.Count > 0)
{
comborawid.DataSource = DS.Tables[0];
comborawid.DisplayMember = "Raw_Material";
comborawid.ValueMember = "Raw_Material_ID";
//combo1.Items.Insert(0, "--Select--");
}
else
{
lblMsg.Text = "No product found";
}
private void combo1_SelectedIndexChanged(object sender, EventArgs e)
{
string proid=(combo1.SelectedIndex.ToString());
fillrawmaterialid(proid);
}</pre>
Now with valuemember and Display member i am getting values in combo1 but i also want the list of raw material corressponding to selected index of Combo1 in cborawmaterial.
e.g if I select Product laptop in combo1_SelectedIndexChanged then only I should get specific raw material related to laptop not all rawmaterials which is stored in database
but i am getting whole list of raw material
do tell me about select query ...what change is need?
akminder
15-Feb-12 8:28am
View
yes it is a window application and i m displaying using label control
akminder
7-Feb-12 5:35am
View
I have installed again SQL server 2008 and Visual studio 2008 after that i am trying to install Service pack 1 of Visual studio but error occurs after the following steps described below:
1 Run the softwware.
2 Accepted licence conditions.
3 Selecting all the features and press next.While pressing next error occurs i.e
There are validation errors on this page.review error on the bottom of setup page,then provide valid parameters.
Error is there are no SQL Server instances or shared features that can be updated on this computer.
Pls suggest me some solution
akminder
6-Feb-12 8:32am
View
thanx i'll try this link
Show More