Click here to Skip to main content
15,910,130 members
Home / Discussions / Database
   

Database

 
QuestionStoredProcedures - which is fastest and why Pin
alwinSCH17-Mar-10 22:39
alwinSCH17-Mar-10 22:39 
JokeRe: StoredProcedures - which is fastest and why Pin
Mycroft Holmes17-Mar-10 23:27
professionalMycroft Holmes17-Mar-10 23:27 
GeneralRe: StoredProcedures - which is fastest and why Pin
alwinSCH17-Mar-10 23:53
alwinSCH17-Mar-10 23:53 
AnswerRe: StoredProcedures - which is fastest and why Pin
WoutL18-Mar-10 0:26
WoutL18-Mar-10 0:26 
GeneralRe: StoredProcedures - which is fastest and why Pin
alwinSCH18-Mar-10 0:50
alwinSCH18-Mar-10 0:50 
GeneralRe: StoredProcedures - which is fastest and why Pin
WoutL18-Mar-10 1:15
WoutL18-Mar-10 1:15 
GeneralRe: StoredProcedures - which is fastest and why Pin
Mycroft Holmes18-Mar-10 11:44
professionalMycroft Holmes18-Mar-10 11:44 
QuestionDataGridView problem with cell coloring [modified] Pin
Mattzimmerer17-Mar-10 15:54
Mattzimmerer17-Mar-10 15:54 
I'm not sure if this is the best place to post this, but I'm retrieving a table form an SQL database and databinding the contents into a DataGridView.

I have some code that searches the entire DataGridView and locates null values, and I intend to color the fields red so the user knows he needs to put something in.

private void button1_Click(object sender, EventArgs e)
{
    //MessageBox.Show(dataGridView.ColumnCount.ToString());
    for (int column = 0; column < 1; column++)//this.dataGridView.ColumnCount
    {
        for (int row = 0; row < this.dataGridView.RowCount; row++)
        {
            //MessageBox.Show("Row,Column: "+row.ToString()+","+column.ToString());
            if (this.dataGridView.Rows[row].Cells[column].Value == null)
            {
                this.dataGridView.Rows[row].Cells[column].Style.BackColor= Color.Red;               //EDITED: changed property to BackColor like I should have posted it...
                //MessageBox.Show("Null at: " + row.ToString() + "," + column.ToString());
            }
        }
    }
}

theres still some messageboxes in there that I used to figure this out...
If I change the conditional statement to (this.dataGridView.Rows[row].Cells[column].Value != null) so that it searches for non null fields, it successfully colors the cells.

I guess my problem has to do with the nullity (lol is that a word?) of my cells.

I guess I should include how I am populating my dataGridView...:
private void Form1_Load(object sender, EventArgs e)
{
    // TODO: This line of code loads data into the '_Vehicle_EquipmentDataSet._Pickups___Cars' table. You can move, or remove it, as needed.
    this.pickups___CarsTableAdapter.Fill(this._Vehicle_EquipmentDataSet._Pickups___Cars);
}

that was auto generated =)

Perhaps I can handle the null data when the list is populated?


Thanks in advance!!!
modified on Thursday, March 18, 2010 12:45 PM

AnswerRe: DataGridView problem with cell coloring Pin
Luc Pattyn17-Mar-10 16:22
sitebuilderLuc Pattyn17-Mar-10 16:22 
GeneralRe: DataGridView problem with cell coloring Pin
Mattzimmerer17-Mar-10 18:58
Mattzimmerer17-Mar-10 18:58 
AnswerRe: DataGridView problem with cell coloring Pin
darkelv17-Mar-10 17:49
darkelv17-Mar-10 17:49 
AnswerRe: DataGridView problem with cell coloring Pin
Mattzimmerer18-Mar-10 9:41
Mattzimmerer18-Mar-10 9:41 
QuestionPrimary Indexed? Pin
Mike65432117-Mar-10 9:06
Mike65432117-Mar-10 9:06 
AnswerRe: Primary Indexed? [modified] Pin
i.j.russell17-Mar-10 9:39
i.j.russell17-Mar-10 9:39 
GeneralRe: Primary Indexed? Pin
Mike65432117-Mar-10 9:53
Mike65432117-Mar-10 9:53 
GeneralRe: Primary Indexed? Pin
Jörgen Andersson17-Mar-10 10:50
professionalJörgen Andersson17-Mar-10 10:50 
GeneralRe: Primary Indexed? Pin
i.j.russell17-Mar-10 11:14
i.j.russell17-Mar-10 11:14 
GeneralRe: Primary Indexed? Pin
Jörgen Andersson17-Mar-10 11:15
professionalJörgen Andersson17-Mar-10 11:15 
Questionnvarchar vs varchar Pin
Mike65432117-Mar-10 7:11
Mike65432117-Mar-10 7:11 
AnswerRe: nvarchar vs varchar Pin
Jörgen Andersson17-Mar-10 8:31
professionalJörgen Andersson17-Mar-10 8:31 
GeneralRe: nvarchar vs varchar Pin
Mike65432117-Mar-10 8:42
Mike65432117-Mar-10 8:42 
GeneralRe: nvarchar vs varchar Pin
Mycroft Holmes17-Mar-10 13:09
professionalMycroft Holmes17-Mar-10 13:09 
AnswerRe: nvarchar vs varchar Pin
carlecomm22-Mar-10 1:59
carlecomm22-Mar-10 1:59 
QuestionEncryption Store Procedures in Bulk in Mssql express 2008. Pin
r_mohd17-Mar-10 4:59
r_mohd17-Mar-10 4:59 
AnswerRe: Encryption Store Procedures in Bulk in Mssql express 2008. Pin
Mycroft Holmes17-Mar-10 13:07
professionalMycroft Holmes17-Mar-10 13:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.