15,897,371 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 Python 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 15212425 (Top 14 by date)
Member 15212425
3-Jul-21 0:12am
View
i was doing in layers. but i am trying to optimize my code.
Member 15212425
1-Jul-21 7:54am
View
thanks for the note . can u help me with ? here i am using 2 loops .. i want to do evrything in single loop . how can i do that ?
var dataReader = sqlDataReader;
if(dataReader.HasRows)
{
data.Add(Convert.ToString(dataReader[0]));
for (int i = 0; i < data.Count; i++)
{
string mo = data[i] + dt;
data[i] += dt;
cmd.CommandText = "update students SET Progress = 'Printed', Name= '" + mo + "' where name like '" + data[i] + "%' ";
data[i] += dt;
cmd.ExecuteNonQuery();
}
}
dataReader.Close();
string HR = string.Join(";", data.ToArray());
Member 15212425
1-Jul-21 7:30am
View
I am trying to do like this to optimize my code . i dont want to use 2 loops . sorry i am new to coding .
var dataReader = sqlDataReader;
if(dataReader.HasRows)
{
data.Add(Convert.ToString(dataReader[0]));
for (int i = 0; i < data.Count; i++)
{
string mo = data[i] + dt;
data[i] += dt;
cmd.CommandText = "update students SET Progress = 'Printed', Name= '" + mo + "' where name like '" + data[i] + "%' ";
data[i] += dt;
cmd.ExecuteNonQuery();
}
}
dataReader.Close();
string HR = string.Join(";", data.ToArray());
Member 15212425
1-Jul-21 6:47am
View
can u pls explain how to do that ?
Member 15212425
1-Jul-21 6:28am
View
if(dataReader.HasRows)
{
data.Add(Convert.ToString(dataReader[0]));
dataReader.Close();
cmd.CommandText = "update students SET Progress = 'Printed', Name= '" + mono + "' where Name like '" + data[i] + "%' ";
data[i] += dt;
cmd.ExecuteNonQuery();
} i tried to do this way . bt its not working
Member 15212425
1-Jul-21 5:59am
View
data retrieving
while(dataReader.Read())
{
data.Add(Convert.ToString(dataReader[0]));
}
updating and storing that data to another array
for (int i = 0; i < data.Count; i++)
{
string mo = data[i] + dt;
// data[i] += dt;
cmd.CommandText = "update students SET Progress = 'Printed', Name= '" + mo + "' where Name like '" + data[i] + "%' ";
data[i] += dt;
cmd.ExecuteNonQuery();
}
string mono = string.Join(";", data.ToArray());
I want to perform both task in a single loop .
Member 15212425
28-Jun-21 8:15am
View
yes that one will also get updated . when i'm doing Student like '" + i% + "' ";
itz not working . how to code % on that ??
Member 15212425
30-May-21 13:33pm
View
check if condition true and popup messagebox only once . my program showing messagebox each time when data is adding from datareader to lstbox .
i am storing count of listbox to q and another in r . to check integer im converting to numbers. on each adding of elements ,its checking , after full adding i want to check if condition .
i am new in c# programming
Member 15212425
30-May-21 13:14pm
View
but when im giving if condition inside the lopp, im no still gettng the desired solution . if list box count is 2 ,itz only showing one and if p=q , still messagebox working
Member 15212425
30-May-21 8:02am
View
I want to check if datareader[0] count is greater than rowcount..
when fetching distinct values only ,dr[0] doesnt have rowcount number of data
int rowcount = Convert.ToInt32(Settings.Default["outercode"]);
string query2 = string.Format($" select Distinct top({ rowcount}) OuterCode,OuterCode_Result,MasterCode,PalletCode from BatchDetails Where OuterCode_Result = 1 and " +
" MasterCode IS NULL and PalletCode IS NULL");
using (SqlCommand sqlCommand = new SqlCommand(query2, sqlConn3))
{
sqlCommand.Parameters.AddWithValue("@OuterCode_Result", 1);
sqlCommand.Parameters.AddWithValue("@MasterCode", "NULL");
sqlCommand.Parameters.AddWithValue("@PalletCode", "NULL");
//sqlCommand.Parameters.Add(textBox2.Text,SqlDbType.Int);
SqlDataReader sqlDataReader1 = sqlCommand.ExecuteReader();
var dataReader = sqlDataReader1;
while (dataReader.Read())
{
if (datareader[0].count >= rowcount ){
listBox1.Items.Add(dataReader[0]);}
}
Member 15212425
30-May-21 0:53am
View
Thank you sir .when im doing this . i got it . but top itmes are same data . what if i need to take single data . if data is like 2,3,3,4,4,5,5,6 .. i want to take data as 2,3,4,5 so on .
i dont want duplication in my listbox
Member 15212425
29-May-21 10:31am
View
I tried many methods ..this is one ..
in sql they are showing this method ..thatz why i tried.
can u plz help me
Member 15212425
29-May-21 10:28am
View
Im not getting desired answer
Member 15212425
29-May-21 7:08am
View
the limit is user input data stored in app.config. respective to that number , i want to display data to listbox .
Show More