Hi,
can you tell me , in which case u want to change the color?

According to ur SQL if

 "AND Out_of_Office.Out_of_Office_Start_Date IS NOT NULL" & _
       "AND Out_of_Office.Out_of_Office_End_Date IS NOT NULL"
true, then do u want to change the color?

while returning data from database, set a flag value like 0 for red 1 for
blue...
in .NET  1.X  u can utilize item databound event there u can check this
flag value and set the row color something lke
e.item.cells.forecolor=system... drawing.color.red

in .net 2.0 or above in Gridview u can utlize rowbound event....
Thanks
Sanker
On Sat, Feb 13, 2010 at 5:34 PM, ricky <[email protected]> wrote:

> I have an Access database with the following two tables. I've listed
> the columns names under the cooresponding tables.
>
> Primary Table name: PhoneInfo                        Secondary Table
> name: Out_of_Office
> Col. name: Contact_Name                                 Col. name:
> Contact_Name
> Col. name: Nick_Name                                      Col. name:
> Out_of_Office_Start_Date
> Col. name: 1st_Choice                                      Col. name:
> Out_of_Office_End_Date
> Col. name: 2nd_Choice                                     Col. name:
> Manager_Name
> Col. name: 3rd_Choice
> Col. name: Other_Info
>
> Basically, I want to compare the "Contact_Name" columns from both
> tables for a match and then if there is data in
> columns:"Out_of_Office_Start_Date"  and  "Out_of_Office_End_Date"
>
> I think my SQL would look something like this:
>
> Dim sSQL As String = "SELECT PhoneInfo.Contact_Name,
> Out_of_Office.Contact_Name" & _
>        "Out_of_Office.Out_of_Office_Start_Date,
> Out_of_Office.Out_of_Office_End_Date" & _
>        "FROM PhoneInfo, Out_of_Office" & _
>        "WHERE PhoneInfo.Contact_Name = Out_of_Office.Contact_Name" &
> _
>        "AND Out_of_Office.Out_of_Office_Start_Date IS NOT NULL" & _
>        "AND Out_of_Office.Out_of_Office_End_Date IS NOT NULL"
>
> But, I'm not sure how to change the color of the datagrid row to red
> let's say if the SQL above is true.
>
> I only display table: PhoneInfo in my datagrid. Both tables are
> updated and linked to Access via SharePoint. My VB 2005 application
> just reads the data from Access.
>
>
> Sub Routine below brings in the data from Access. The SQL above would
> somehow be incorporated within the sub routine, but I need to figure
> out how to change to color of the row????
>
>  Sub Update_Database()
>        Dim myBindingSource As New BindingSource
>        Dim sSQL As String = "SELECT * FROM PhoneInfo"
>        Dim cmd As OleDbCommand = New OleDbCommand(sSQL, conn)
>        adapter = New OleDbDataAdapter(cmd)
>        myDataSet = New DataSet
>        adapter.Fill(myDataSet)
>        myBindingSource.DataSource = myDataSet.Tables(0).DefaultView
>        DataGridView1.DataSource = myBindingSource
>  End Sub
>
> thanks, I hope I explained my question correctly??
>



-- 
"People who never make mistakes, never do anything."

Crazy

Reply via email to