15,902,938 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 ramy nemer (Top 27 by date)
ramy nemer
9-Sep-16 12:54pm
View
the datatable have three rows,what its doing is its filling the dgv in three same rows,how should i fill them in dgv in specifying its columns ,without using databind
ramy nemer
9-Sep-16 12:29pm
View
its filling me the last record only in dgv
ramy nemer
9-Sep-16 12:26pm
View
it passes through the first foreach only one time once it enters the second foreach it loops through it until it finishes (values are not changing from the 1st foreach)
ramy nemer
6-Jul-16 16:18pm
View
i dont know why i am inserting the dgv values to a datatable, cant i access the datagridview in form2 directly from form1 ?? fetch it and send its values to database
ramy nemer
6-Jul-16 11:58am
View
i think the best way is to use a public class but i dont know how
ramy nemer
6-Jul-16 11:58am
View
no this doesnt work for me , the values are in form2 ,i need to pass them to form1 to use it to insert to databaseto
ramy nemer
6-Jul-16 9:34am
View
yeah but can u give me an example of this please i apreciate it
thanks
ramy nemer
5-Jul-16 9:10am
View
index was out of range . must be non negative and less than the size of the collection. Parameter name = index
ramy nemer
21-Jun-16 19:06pm
View
its better to use one sqlcommand for all queries ? am a little bit confused of this cz am having multiple tables to insert to and at last i need to use if all controls are !null it can save changes,so its more easy to use one sqlcommand for all queries to deal with this condition ??
ramy nemer
21-Jun-16 19:02pm
View
you mean liike this :
string StrQuery = "INSERT INTO [dbo].[collaborationUnit] (incidentNo, PuserNickname, tokenId, PoliceUserRole) VALUES (@incidentNo, @PuserNickname, @tokenId, @PoliceUserRole)";
SqlCommand cmd10 = cnn.CreateCommand();
cmd10.CommandText = StrQuery;
for (int i = 0; i < dataGridView5.Rows.Count; i++)
{
cmd10.Parameters.AddWithValue("@incidentNo", newLastIncidentNo);
cmd10.Parameters.AddWithValue("@PuserNickname", dataGridView5.Rows[i].Cells["Column26"].Value);
cmd10.Parameters.AddWithValue("@tokenId", dataGridView5.Rows[i].Cells["Column31"].Value);
cmd10.Parameters.AddWithValue("@PoliceUserRole", dataGridView5.Rows[i].Cells["Column32"].Value);
cmd10.Connection = cnn;
cmd10.ExecuteNonQuery();
}
ramy nemer
20-Jun-16 17:53pm
View
i have a question concerning iteration,while reading rows if there is a row having Id = newLastIncidentNo,i increment newLastIncidentNo,but i want the reader to start over again how should i do it ? this is the code :
using (var cmd105 = new SqlCommand("select incidentNoReserveId from [dbo].[incidentNoReserve]", cnn))
{
cnn.Open();
SqlDataReader reader = cmd105.ExecuteReader();
while (reader.Read())
{ //Every new row will create a new dictionary that holds the columns
if ((Convert.ToInt16(reader["incidentNoReserveId"])) == newLastIncidentNo)
{
newLastIncidentNo = newLastIncidentNo + 1;
//reader.Close();
}
}
cnn.Close();
}
ramy nemer
20-Jun-16 17:48pm
View
very helpfull thanks , i am not deleting all rows,based on matching i am deleting a single row with the matching Id.
what am i trying to do is once running the application i bring the last Id +1 from incidentNo and then saving this id in incidentNoReserve tbl,if i exit the application this Id is deleted without saving anything but if application is saved this Id is saved in incidentNo tbl and deleted from incidentNoReserve ,by this work i can retrieve an Id upon form load and reserve a place for it in database. Now am changing and fixing the if statements to ensure safety in database.
ramy nemer
20-Jun-16 17:21pm
View
it worked i erased the inner cnn.Open and close, but u mean adding in outer block a connection before using (var cmd106 = new SqlCommand("select * from [dbo].[incidentNoReserve]", cnn)) ??
ramy nemer
20-Jun-16 6:55am
View
yeah it make sense but am working on it to ensure security and safety. Thanks for your advice
ramy nemer
20-Jun-16 3:45am
View
the ID is incremented by 1 so no duplicate ID's is allowed, but there is a way to do that
ramy nemer
13-Jun-16 18:58pm
View
the last query how should i put it in code
ramy nemer
7-Jun-16 10:31am
View
Deleted
i found the issue,it was dataGridView7[2 , e.rowindex].Value = drFound["fasileOne"];
not dataGridView7[e.RowIndex, 2].Value = drFound["fasileOne"];
columns then rows
thanks a lot Mr
ramy nemer
7-Jun-16 10:22am
View
well i don't have a limited rows George, what i can do , i got lost here
ramy nemer
7-Jun-16 9:55am
View
on dataGridView7[e.RowIndex, 2].Value = drFound["fasileOne"];
ramy nemer
7-Jun-16 9:42am
View
private void dataGridView7_CellValueChanged(object sender, DataGridViewCellEventArgs e)
{
if ((e.RowIndex > -1) && (e.ColumnIndex == 1)) // Assuming this is the streetId
{
int streetId = Convert.ToInt16(dataGridView7.Rows[e.RowIndex].Cells[e.ColumnIndex].Value);
DataRow drFound = tblSecondary.Rows.Find(streetId);
if (drFound == null)
{
MessageBox.Show("ddhhdhd");
}
else
{
dataGridView7[e.RowIndex, 2].Value = drFound["fasileOne"];
dataGridView7[e.RowIndex, 3].Value = drFound["fasileTwo"];
}
}
tblSecondary = new DataTable();
SqlCommand cmd2 = cnn.CreateCommand();
cmd2.CommandText = "select * from street";
SqlDataAdapter sdr2 = new SqlDataAdapter(cmd2);
cmd2.CommandType = CommandType.Text;
cmd2.Connection = cnn;
sdr2.Fill(tblSecondary);
tblSecondary.PrimaryKey = new DataColumn[] { tblSecondary.Columns["streetId"] };
i changed the position of the primary key,its working but an exception occurs :
Index was out of range. Must be non-negative and less than the size of the collection.
ramy nemer
7-Jun-16 9:26am
View
thanks george , but i have the tblsecondary having all columns,i marked the primary key in it, when running the program its giving me that this table doesnt have a primary key why ?
ramy nemer
7-Jun-16 6:21am
View
sorry can you give any suggestion or a simple code of how do it that please
ramy nemer
7-Jun-16 3:29am
View
with isfsectionId1 and isfsectionId2 (foreign keys for isfsectionId in isfsections)
i have the table street :
streetId streetName areaId isfsectionId1 isfsectionId2
1 street1 3 8 5
2 street2 5 4 null
i need when i click streetname in comboboxcolumn index 1 the two textboxes is filled automatically with isfSectionName
ramy nemer
1-Jun-16 14:32pm
View
well thanks, am new to c# and collection i will try to search for it
ramy nemer
31-May-16 10:12am
View
well am completely lost have been spending a long time for fixing this issue but dead end ,can u provide me simple code or a reference i can get help please
ramy nemer
31-May-16 10:07am
View
Thanks my friend i will take it into consideration
ramy nemer
31-May-16 10:05am
View
nothing changed still the same
Show More