473,394 Members | 1,737 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Customize DataGrid View

Hi all,
I am using Visual Studio 2005 and Visual basic.

I've created a form with two ComboBoxes and a DataGrid
I binned the ComboBoxes to a table on my remote SQL2005 server

What I want to do is use the info from the two ComboBoxes
To create a SELECT query and display it on the DataGrid

For example:
If the user selected from cmb1 a "Username" and on cmb2 "failed
Reports"
Execute a SELECT query

SELECT * from students where sname LIKE @cmb1 and status LIKE @cmb2

And show it on the DataGrid

Any Suggestions? (Would be greatly appreciated if someone can paste a
sample code)
Dec 26 '07 #1
1 1335
You could If you are building the string to run your select use
String.Format as so:

<code>
dim retVal as string = String.Format("SELECT * FROM Students WHERE sName
LIKE @{0} AND [Status] LIKE @{1}", Combo1Value.ToString,
Combo2Value.ToString)
</code>

BUT you might want to review doing this as it leaves the application open to
SQL injection attacks and could have someone running a DROP TABLE or DELETE
FROM statement on your DB tables.

HTH Brendon

<R.*****@gmail.comwrote in message
news:11**********************************@r60g2000 hsc.googlegroups.com...
Hi all,
I am using Visual Studio 2005 and Visual basic.

I've created a form with two ComboBoxes and a DataGrid
I binned the ComboBoxes to a table on my remote SQL2005 server

What I want to do is use the info from the two ComboBoxes
To create a SELECT query and display it on the DataGrid

For example:
If the user selected from cmb1 a "Username" and on cmb2 "failed
Reports"
Execute a SELECT query

SELECT * from students where sname LIKE @cmb1 and status LIKE @cmb2

And show it on the DataGrid

Any Suggestions? (Would be greatly appreciated if someone can paste a
sample code)
Jan 3 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Bill C. | last post by:
Hello, I know this has been discussed a lot already because I've been searching around for information the last few weeks. I'm trying to implement a DataGridComboBoxColumn class. I've found...
0
by: Maria | last post by:
Hi I am new to .NET and would like to know how do we customize the apprearance of a datagrid Precisely, I would like to make ONE row appear in BOLD, and I would like to specify the number of...
2
by: Hai Ly Hoang | last post by:
Hi, Datagrid is a great control ! But now, i want to customize it : draw a picture on the header row (the topmost row) ! Is it possible ? And how ? Thanks
1
by: James Lennon | last post by:
How can I customize a DataGrid row based on the row properties. For istance if a column is 0 make the row bold or red. I have only been able to format a datagrid based on columns. James
1
by: Amy Snyder | last post by:
I have a datagrid where I incorporate paging and sorting. My datagrid page mode is set to numeric. Is there a way for me to customize this to display something like this in the page header: ...
1
by: David Lozzi | last post by:
Hi, I'd like to customize a header in a DataGrid. I want to add a link in the header, as well as pull a recordset's ID. I am using a TemplateColumn so that I can hold several lines of...
0
by: Ray | last post by:
I am trying to add a "Next >" and "<Prev" button to the pager of my datagrid. I have been able to add the hyperlinks to the pager. I am now trying to determine the correct postback script to...
4
by: Fred | last post by:
Hello, datagrids have GridLines, BorderWidth, BorderColor, ItemStyle.CssClass, ShowFooter ... properties, which can be used to customize the way they look when printed, how does one achieve the...
0
Iman100
by: Iman100 | last post by:
Hi I have quiz (MCQ) data stored in my Database. I need to customize the question view to show the question then use RadioButtonList to display my choices. Is there is any tutorial or guide I can...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.