16,022,828 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 Visual Basic questions
View Javascript 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 Member 12005342 (Top 16 by date)
Member 12005342
4-Mar-16 7:35am
View
After hitting search button the above code I have written....
Don't knw how to wait till search complete and read the result...your help is greatly appreciated
Member 12005342
4-Mar-16 7:32am
View
Code is here
For each ele in ie.document.all
Select case ele.id
Case "result-count"
Sht.range("A1")=ele.innertext
End select
Next
Can you please tell me where I need to loop to store result value after search complete.
Member 12005342
28-Sep-15 15:36pm
View
Thank you john
Code worked perfect
Thanks again
Member 12005342
28-Sep-15 14:46pm
View
Thank you soo much john for your help
Code is working and I am able to display all the data but only problem is next time when I search for another customer it is displaying both previous and this customer details.
Member 12005342
28-Sep-15 13:52pm
View
Yes I tried and I am getting run time error @ da1.fill(table 2).
Stating " in operator without () in querry expression 'Productid in @productid' "
Member 12005342
28-Sep-15 10:30am
View
Yes john still searching for the code
Could you please help in the code
Member 12005342
25-Sep-15 14:59pm
View
Its reading all the values but not displaying .. Even after using execute reader I am getting the same output only last value is getting displayed
Member 12005342
25-Sep-15 14:58pm
View
In this code I am getting runtime error stating " syntax value error in query" @ Da1.fill(table2);
Member 12005342
25-Sep-15 13:20pm
View
Hi john can you please help me in writing that code
I am not getting how to save data inside loop without overwrite and display outside
Member 12005342
25-Sep-15 6:37am
View
As John said here I am reading all productid for given customerid
And in my DB customer I'd is alphanumeric
Member 12005342
25-Sep-15 6:35am
View
Can you please help in this how to add one by one data inside loop
And display all values??
Not getting how to write code foe that
Member 12005342
25-Sep-15 4:01am
View
As suggested I created two methods
I stored first database value to array and trying to use in database 2 all working fine but only last value is getting printed
Here is my code:
method1:
using System.Data.SqlClient;
// .....
string queryString = "Select productID from Table1 where custid="+ textbox1.text;
List TempproductID = new List() ;
using (SqlConnection connection = new SqlConnection(connectionString))
{
SqlCommand command = new SqlCommand(queryString, connection);
connection.Open();
SqlDataReader reader = command.ExecuteReader();
while (reader.Read())
{
if (!reader.IsDBNull(0))
{
Tempproductid.add( reader[0].ToString());
}
}
reader.Close();
tempproductid.toarray();
}
method 2:
String stringprovider = "@database connection string ";
for ( int I = 0; I < tempproductid.count; I++)
{
Sqlconnection con2 = new sqlconnection(stringprovider); Con2.open();
Cmd2.connection=con2; Cmd2.commandType = new commandType.text; Cmd2.commandText = "select * from Table2 where Productid = @productid"; Cmd2.parameters.addwithvalue("@productid",Tempproductid[i].to string());
Dataset Ds = new dataset(); sqldataadaptaer da1 = new sqldataadapter(cmd2); Datatable Table2 = new Data table(); Da1.fill(table2);
Datagridview2.source = table2;
}
}
In that for loop only one value is getting in datagridview not getting all
Member 12005342
25-Sep-15 4:01am
View
As suggested I created two methods
I stored first database value to array and trying to use in database 2 all working fine but only last value is getting printed
Here is my code:
method1:
using System.Data.SqlClient;
// .....
string queryString = "Select productID from Table1 where custid="+ textbox1.text;
List TempproductID = new List() ;
using (SqlConnection connection = new SqlConnection(connectionString))
{
SqlCommand command = new SqlCommand(queryString, connection);
connection.Open();
SqlDataReader reader = command.ExecuteReader();
while (reader.Read())
{
if (!reader.IsDBNull(0))
{
Tempproductid.add( reader[0].ToString());
}
}
reader.Close();
tempproductid.toarray();
}
method 2:
String stringprovider = "@database connection string ";
for ( int I = 0; I < tempproductid.count; I++)
{
Sqlconnection con2 = new sqlconnection(stringprovider); Con2.open();
Cmd2.connection=con2; Cmd2.commandType = new commandType.text; Cmd2.commandText = "select * from Table2 where Productid = @productid"; Cmd2.parameters.addwithvalue("@productid",Tempproductid[i].to string());
Dataset Ds = new dataset(); sqldataadaptaer da1 = new sqldataadapter(cmd2); Datatable Table2 = new Data table(); Da1.fill(table2);
Datagridview2.source = table2;
}
}
In that for loop only one value is getting in datagridview not getting all
Member 12005342
24-Sep-15 17:24pm
View
As suggested I created two methods
I stored first database value to array and trying to use in database 2 all working fine but only last value is getting printed
Here is my code:
method1:
using System.Data.SqlClient;
// .....
string queryString = "Select productID from Table1 where custid="+ textbox1.text;
List<string> TempproductID = new List<string>() ;
using (SqlConnection connection = new SqlConnection(connectionString))
{
SqlCommand command = new SqlCommand(queryString, connection);
connection.Open();
SqlDataReader reader = command.ExecuteReader();
while (reader.Read())
{
if (!reader.IsDBNull(0))
{
Tempproductid.add( reader[0].ToString());
}
}
reader.Close();
tempproductid.toarray();
}
method 2:
String stringprovider = "@database connection string ";
for ( int I = 0; I < tempproductid.count; I++)
{
Sqlconnection con2 = new sqlconnection(stringprovider); Con2.open();
Cmd2.connection=con2; Cmd2.commandType = new commandType.text; Cmd2.commandText = "select * from Table2 where Productid = @productid"; Cmd2.parameters.addwithvalue("@productid",Tempproductid[i].to string());
Dataset Ds = new dataset(); sqldataadaptaer da1 = new sqldataadapter(cmd2); Datatable Table2 = new Data table(); Da1.fill(table2);
Datagridview2.source = table2;
}
}
In that for loop only one value is getting in datagridview not getting all
Member 12005342
23-Sep-15 19:27pm
View
I have two database In database1 I am having table1 (custid,productid,customername )
Database2 : table2 (productname,productid, pice, mfg)
I want to display all the products purchased by particular custid
Here is my code :
C#
using System.Data.SqlClient;
// .....
string queryString = "Select custID from Table1 where custId ="+ textbox1.text;
String TempCustID;
using (SqlConnection connection = new SqlConnection(connectionString))
{
SqlCommand command = new SqlCommand(queryString, connection);
connection.Open();
SqlDataReader reader = command.ExecuteReader();
while (reader.Read())
{
if (!reader.IsDBNull(0))
{
TempCustID = reader[0].ToString();
String stringprovider = "@database connection string ";
Sqlconnection con2 = new sqlconnection(stringprovider);
Con2.open();
Cmd2.connection=con2;
Cmd2.commandType = new commandType.text;
Cmd2.commandText = "select * from Table2 where Productid = @productid";
Cmd2.parameters.addwithvalue("@productid",TempCustID);
}
}
reader.Close();
Dataset Ds = new dataset();
Oledbdataadaptaer da1 = new oledbdataadapter(cmd2);
Datatable Table2 = new Data table();
Da1.fill(table2);
Datagridview2.source = table2;
}
In this I am getting only the first product details of that customer its not displaying all the products at a time.
Please suggest.
Member 12005342
23-Sep-15 6:02am
View
I tried constructing query but its giving me error
Here is my code for that
String strsql = "select * from customer where custID = " + TempCustID; //connecting database
DataTable customer = new Datable();
da1.Fill(Customer); // here I am getting error "no value given for one or more required parameters"
Datagridview1.data source = Customer;
Show More