I am writing a program that pulls data from a SQL table connected to an Access database and then populates a DataGridView on a Windows form.
I am wondering if there is a way in the select statement to set parameters around the data I am pulling such as, if I select a column and the data is 1 or 0, the DataGridView can display 1 as yes and 0 as no.
I have tried adjusting the select statement and writing cell formatting functions but nothing seems to be working.
For example:
da = New OleDbDataAdapter("select IA, CASE 1 return 'Yes' case else return 'NO' FROM dbo_tblPLOps_Data WHERE LANID= '" & txtRepID.Text & "' and date >= '" & DateTimePicker1.Text & "' and date <= '" & DateTimePicker2.Text & "'", newScoreConn)
I tried this too:
da = New OleDbDataAdapter("select IA IF (IA = 1, 'yes', 'no')FROM dbo_tblPLOps_Data WHERE LANID= '" & txtRepID.Text & "' and date >= '" & DateTimePicker1.Text & "' and date <= '" & DateTimePicker2.Text & "'", newScoreConn)
I am able to adjust the pull and change the DataGridView column header:
da = New OleDbDataAdapter("select IA as [Info Accuracy] FROM dbo_tblPLOps_Data WHERE LANID= '" & txtRepID.Text & "' and date >= '" & DateTimePicker1.Text & "' and date <= '" & DateTimePicker2.Text & "'", newScoreConn)