473,396 Members | 1,836 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,396 software developers and data experts.

display data to datagrid

hey there..
i want to display my data that only has the same "gender" to the datagrid.

Expand|Select|Wrap|Line Numbers
  1.     Dim rs6 As New ADODB.Recordset
  2.  
  3.     With rs6
  4.         .ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Dbname & ";Persist Security Info=False"
  5.         .CursorLocation = adUseClient
  6.         .LockType = adLockOptimistic
  7.         .CursorType = adOpenStatic
  8.         .Source = "SELECT * FROM Data WHERE Gender = '" & comboGender.Text & "'"
  9.         .Open
  10.  
  11.         dgData.Columns(0).Value = .Fields(0).Value
  12.         dgData.Columns(1).Value = .Fields(1).Value
for my code it only show 1 record, though there's 10 records in database.
what code that i miss?
thanks in advance.. =)
Dec 3 '07 #1
5 1406
QVeen72
1,445 Expert 1GB
hI,

Check This :


Expand|Select|Wrap|Line Numbers
  1.  
  2.     Dim rs6 As New ADODB.Recordset    
  3.     With rs6
  4.         .ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Dbname & ";Persist Security Info=False"
  5.         .CursorLocation = adUseClient
  6.         .LockType = adLockOptimistic
  7.         .CursorType = adOpenStatic
  8.         .Source = "SELECT * FROM Data WHERE Gender = '" & comboGender.Text & "'"
  9.         .Open        
  10.         Set dgData.DataSource = rs6
  11.         dgData.Refresh
  12.      End With
  13.  
Regards
Veena
Dec 3 '07 #2
To Mr/Ms. Veena,
thanks for the code,
it works..
but what about if i want to hide other's column?
that's why i using this code before

Expand|Select|Wrap|Line Numbers
  1. dgData.Columns(0).Value = .Fields(0).Value
  2. dgData.Columns(1).Value = .Fields(1).Value
Thanks...
Dec 3 '07 #3
QVeen72
1,445 Expert 1GB
Hi,

To Hide 3rd Column:(Index Starts From 0)

Expand|Select|Wrap|Line Numbers
  1. dgData.Columns(2).Width=0
  2.  
Regards
Ms. Veena
Dec 3 '07 #4
To Ms.Veena,
forgive me if i still ask the same question
if i want to display only column 0 and 1,
because for column 3 i will add the data myself
so i cant Set dgData.DataSource = rs6 because it displayed whole data

sorry for keeping asking the same question..
thanks in advance..
Dec 3 '07 #5
QVeen72
1,445 Expert 1GB
To Ms.Veena,
forgive me if i still ask the same question
if i want to display only column 0 and 1,
because for column 3 i will add the data myself
so i cant Set dgData.DataSource = rs6 because it displayed whole data
Hi,
Either of these commands will Hide the Third Column :

dgData.Columns(2).Visible = False
Or
dgData.Columns(2).Width = 0

And you can very well use :
Set dgData.DataSource = rs6
As Recordset Object has the Column Data,
Onlything here is Physically, the Column is Hidden, (But Underlying Column in datagrid is Intact)

ColumnWidth / Visible has to be done after the "Set" command..

Regards
Veena
Dec 3 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Chumley the Walrus | last post by:
IN my code behind .vb page for a delete records script (this also does a deletion confirmation with a javascript popup, this gets called on my front .aspx page with the datagrid), I'm not sure if...
5
by: BlueFox | last post by:
Hi : When i display the DataBase in System.Windows.Forms. DataGrid ,i want to display the line number of ever line .How can i do it ? Any help may be Good .
18
by: Alpha | last post by:
Hi, I'm working on a Windows applicaton with VS 2003 on windows 2000. I have a listbox that I have binded to a dataset table, "source" which has 3 columns. I would like to display 2 of those...
3
by: Andrew S. Giles | last post by:
Hello, I am importing a flat text file, and putting it into a datagrid for display on a form. Currently the users have their dates and times seperated. I have two fields, therefore in the...
1
by: Craig Banks | last post by:
If a row of data in a dataset has a lot of columns the row displaying the data in a datagrid will run way off the screen. What I'd like to do is display a row of data over several datagrid rows so...
2
by: news | last post by:
hi im new in the .net environnement i have a work to do in school im able to display a datagrid using a database in access and im also able to display a datagrid using a database in foxpro 8.0...
2
by: Cindy | last post by:
Hello. For some reason, I am able to "connect" to the Northwind database whenever I use the wizard; however, when I run the application, my datagrid does not display. Here are the exact steps I...
2
by: harry | last post by:
Hi all, I have a datagrid (language C#) populated using a stored procedure. I want one of the column to display complete name instead of abbreviation. Can I change the display dynamically in the...
2
by: pozze | last post by:
Hi, I need to display images and other record information retrieved from an SQL 2005 database in a datagrid on a web page. I'm coding in VB .net I have recently changed over from VB ASP and i'm...
2
by: simonyong | last post by:
hello, anyone.. im newbie to asp.net my problem is : My task is related to view all data from a table called "employee " i had create a datagrid where called data from database and...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.