Is there a way to bind a datagrid in VB.Net to an ADODB Recordset object? I
have tried:
rs.Open ("SELECT Name FROM tblStaff",conne ction)
dgTest.SetDataB indings(rs,"")
The recordset is filled but it returns an error at the datagrid
databinding.
TIA :-)
--
ats@home
When an old lady got hit by a truck
I saw a wicked gleam in your eye
Handy utils here: http://www.allenjones.co.uk/utils.htm 5 7097
"Allen" <at**@takeyourh atoff.ntalk.org > schrieb Is there a way to bind a datagrid in VB.Net to an ADODB Recordset object? I have tried:
rs.Open ("SELECT Name FROM tblStaff",conne ction)
dgTest.SetDataB indings(rs,"")
The recordset is filled but it returns an error at the datagrid databinding.
The documentation of the Datagrid.dataso urce property lists the variety of
supported data sources.
--
Armin
How to quote and why: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
On Thu, 3 Jun 2004 20:34:39 +0200, Armin Zingler wrote: "Allen" <at**@takeyourh atoff.ntalk.org > schrieb Is there a way to bind a datagrid in VB.Net to an ADODB Recordset object? I have tried:
rs.Open ("SELECT Name FROM tblStaff",conne ction)
dgTest.SetDataB indings(rs,"")
The recordset is filled but it returns an error at the datagrid databinding.
The documentation of the Datagrid.dataso urce property lists the variety of supported data sources.
I have read some of it and from this know that it can be bound to an ADODB
recordset. However, it is the second parameter that is causing the error.
The documentation says that the default is an empty string but it fails. I
have also tried putting the table name in there but that generates an error
saying that a Child record cannot be crteated for the table. What should be
put into the second parameter?
--
ats@home
When an old lady got hit by a truck
I saw a wicked gleam in your eye
Handy utils here: http://www.allenjones.co.uk/utils.htm
Data source must implement the 'IEnumerable' interface
like DataTable, DataView, ArrayList, Hashtable but not
the Recordset. First fill DataTable from Recordset and
then bind DataTable to DataGrid.
Try this code:
Dim custDA As New OleDbDataAdapte r
Dim dtTerritories As New DataTable
Dim Conn As New ADODB.Connectio n
Dim rs As New ADODB.Recordset
Dim dgTest as New dataSet
Conn.Open("<-----Use Connection String------ ";", "", "", -1)
RS.Open("SELECT Name FROM tblStaff", Conn,
ADODB.CursorTyp eEnum.adOpenFor wardOnly,
ADODB.LockTypeE num.adLockReadO nly, 1)
custDA.Fill(dtT erritories, RS)
RS.Close()
Conn.Close()
RS = null
Conn = null
dgTest.DataSour ce = dtTerritories
dgTest.DataBind ()
Also, you make like to Reference traditional DataGrid of
VB 6.0 in Windows Form application. Traditional DataGrid
of VB 6.0 may not work in web application.
Good Luck-----Original Message----- "Allen" <at**@takeyourh atoff.ntalk.org > schrieb Is there a way to bind a datagrid in VB.Net to an
ADODB Recordset object? I have tried:
rs.Open ("SELECT Name FROM tblStaff",conne ction)
dgTest.SetDataB indings(rs,"")
The recordset is filled but it returns an error at the
datagrid databinding. The documentation of the Datagrid.dataso urce property
lists the variety ofsupported data sources.
-- Armin
How to quote and why: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
.
Allen,
You can using the dataadapter make a dataset from a recordset.
I is
datadapter.fill (dataset,record set,"mytable")
However it has less sence because it is only usable for filling the grid,
not for writing back to the recordset.
When you are able to that take the ADONET approach, which is much easier by
the way too.
Cor
On Thu, 3 Jun 2004 15:29:59 -0700, Shirish Kokate wrote: Data source must implement the 'IEnumerable' interface like DataTable, DataView, ArrayList, Hashtable but not the Recordset. First fill DataTable from Recordset and then bind DataTable to DataGrid.
Try this code: Dim custDA As New OleDbDataAdapte r Dim dtTerritories As New DataTable Dim Conn As New ADODB.Connectio n Dim rs As New ADODB.Recordset Dim dgTest as New dataSet
Conn.Open("<-----Use Connection String------";", "", "", -1) RS.Open("SELECT Name FROM tblStaff", Conn, ADODB.CursorTyp eEnum.adOpenFor wardOnly, ADODB.LockTypeE num.adLockReadO nly, 1)
custDA.Fill(dtT erritories, RS) RS.Close() Conn.Close() RS = null Conn = null dgTest.DataSour ce = dtTerritories dgTest.DataBind ()
Also, you make like to Reference traditional DataGrid of VB 6.0 in Windows Form application. Traditional DataGrid of VB 6.0 may not work in web application.
Good Luck
Thanks for that. I will give it a whirl when I get to work :-)
--
ats@home
When an old lady got hit by a truck
I saw a wicked gleam in your eye
Handy utils here: http://www.allenjones.co.uk/utils.htm This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Ashish Shridharan |
last post by:
Hi All
I have been trying to add a control to the header cell of
a datagrid on my ASP.NET page. These controls are defined
in the HTML as ASP.NET web controls.
They are being added into the header of the datagrid in
the "ItemDataBound" method of the grid. However, once,
they are added in the grid, i seem to lose the event
handler for the same control. Is there anyone who has
tried this before and knows why this is hapenning ??
|
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
several examples on the web. They all seem to have problems, though
that I've been unable to resolve.
The most promising example I have found is at:
|
by: BBFrost |
last post by:
Win2000
..Net 1.1 SP1
c# using Visual Studio
Ok, I'm currently in a "knock down - drag out" tussle with the .Net 1.1
datagrid.
I've come to realize that a 'block' of rows highlighted within a datagrid do
>> not << constitute a set of 'selected' records. Apparently one and only
one row may be 'selected' in a datagrid. By selected row I mean the row
|
by: pei_world |
last post by:
I want to implement a key hit with enter to dropdown a combobox that is in
the datagrid. in this case I need to override its original behaviours. I
found some codes from the web. Does anyone know how to use this code? please
help!
http://www.experts-exchange.com/Programming/Programming_Languages/C_Sharp/Q_20862953.html
|
by: Rick |
last post by:
Hello all, I hope all is well with you.
I am having a seriously difficult time with this problem. Allow me to
set
up the problem.
I have a System.Web.UI.Page with the following controls (watch the
layout,
some have child controls):
| |
by: CVerma |
last post by:
Hi,
I have an embedded datagrid within a datalist. I am not able to
perfrom paging in the datagrid. Any ideas? Here is my code:
Here is my Simplegrid.cs file:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
|
by: CSL |
last post by:
I am using the DataGrid in a Windows Application, how can
I adjust the widths of each column individually.
|
by: Dave |
last post by:
Are there any add-on products or samples available that can do the following
in an vb.net datagrid
I want to compare 2 rows in a datagrid - one row from one database and
another row for another database.
So all the even rows would be from database one.
All the odd rows would be from database two.
Row one and two will have different formats and colors.
|
by: rn5a |
last post by:
A Form has a DataGrid which displays records from a SQL Server 2005 DB
table. Users can modify the records using this DataGrid for which I am
using EditCommandColumn in the DataGrid. This is the code:
<script runat="server">
Dim sqlConn As New SqlConnection(".....")
Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs)
If Not (Page.IsPostBack) Then
FillDataGrid()
|
by: =?Utf-8?B?Y3JlYXZlczA2MjI=?= |
last post by:
I have a nested datagrid in a xaml file, the parent datagrid loads the vendor
information and the details loads the documents for that vendor in a
datagrid. Everything is working fine until I click in the child datagrid and
then go to the combobox and choose another vendor. When the new vendor is
loaded nothing shows in the datagrid but the itemsource shows the info is
there. Know if I click on the child cell and then click back on the...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |