PC Review


Reply
Thread Tools Rate Thread

DataGrid and MS Access database

 
 
=?Utf-8?B?Sm9l?=
Guest
Posts: n/a
 
      27th Feb 2005
I have a datagrid on a web form and I am setting the datasource in Page_Load
Event and there are no errors generated, I can interrogate the DataTable and
it returns row count, column count, data in rows, etc., but the DataGrid
itself will NOT appear at all on the web form. Anybody know why?

Thanks.

Joe
**********************

Dim oConn As New OleDbConnection
oConn.ConnectionString = ConnString 'generated outside Page_Load
oConn.Open()

Dim sSQL As String = "select * from REGISTRATION"

Dim da As OleDbDataAdapter = New OleDbDataAdapter(sSQL, oConn)

Dim ds As DataSet = New DataSet
da.Fill(ds, "REGISTRATION")
Me.DataGrid1.DataSource = ds.Tables("REGISTRATION")
lblStatus.Text = ds.Tables(0).TableName & ";Columns = " &
ds.Tables(0).Columns.Count.ToString
lblStatus.Visible = True

--
Joe Baker
 
Reply With Quote
 
 
 
 
Scott M.
Guest
Posts: n/a
 
      27th Feb 2005
Add this to the end:

DataGrid1.DataBind



"Joe" <(E-Mail Removed)> wrote in message
news:567F1594-AA83-4EED-B89A-(E-Mail Removed)...
>I have a datagrid on a web form and I am setting the datasource in
>Page_Load
> Event and there are no errors generated, I can interrogate the DataTable
> and
> it returns row count, column count, data in rows, etc., but the DataGrid
> itself will NOT appear at all on the web form. Anybody know why?
>
> Thanks.
>
> Joe
> **********************
>
> Dim oConn As New OleDbConnection
> oConn.ConnectionString = ConnString 'generated outside Page_Load
> oConn.Open()
>
> Dim sSQL As String = "select * from REGISTRATION"
>
> Dim da As OleDbDataAdapter = New OleDbDataAdapter(sSQL, oConn)
>
> Dim ds As DataSet = New DataSet
> da.Fill(ds, "REGISTRATION")
> Me.DataGrid1.DataSource = ds.Tables("REGISTRATION")
> lblStatus.Text = ds.Tables(0).TableName & ";Columns = " &
> ds.Tables(0).Columns.Count.ToString
> lblStatus.Visible = True
>
> --
> Joe Baker



 
Reply With Quote
 
Scott M.
Guest
Posts: n/a
 
      27th Feb 2005
Actually, to be more precise:

If Not IsPostBack Then
DataGrid1.DataBind
End If


"Scott M." <s-(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Add this to the end:
>
> DataGrid1.DataBind
>
>
>
> "Joe" <(E-Mail Removed)> wrote in message
> news:567F1594-AA83-4EED-B89A-(E-Mail Removed)...
>>I have a datagrid on a web form and I am setting the datasource in
>>Page_Load
>> Event and there are no errors generated, I can interrogate the DataTable
>> and
>> it returns row count, column count, data in rows, etc., but the DataGrid
>> itself will NOT appear at all on the web form. Anybody know why?
>>
>> Thanks.
>>
>> Joe
>> **********************
>>
>> Dim oConn As New OleDbConnection
>> oConn.ConnectionString = ConnString 'generated outside Page_Load
>> oConn.Open()
>>
>> Dim sSQL As String = "select * from REGISTRATION"
>>
>> Dim da As OleDbDataAdapter = New OleDbDataAdapter(sSQL, oConn)
>>
>> Dim ds As DataSet = New DataSet
>> da.Fill(ds, "REGISTRATION")
>> Me.DataGrid1.DataSource = ds.Tables("REGISTRATION")
>> lblStatus.Text = ds.Tables(0).TableName & ";Columns = " &
>> ds.Tables(0).Columns.Count.ToString
>> lblStatus.Visible = True
>>
>> --
>> Joe Baker

>
>



 
Reply With Quote
 
=?Utf-8?B?Sm9l?=
Guest
Posts: n/a
 
      28th Feb 2005
ah, yes. It's the simple things... that worked. Thanks Scott.

"Scott M." wrote:

> Actually, to be more precise:
>
> If Not IsPostBack Then
> DataGrid1.DataBind
> End If
>
>
> "Scott M." <s-(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
> > Add this to the end:
> >
> > DataGrid1.DataBind
> >
> >
> >
> > "Joe" <(E-Mail Removed)> wrote in message
> > news:567F1594-AA83-4EED-B89A-(E-Mail Removed)...
> >>I have a datagrid on a web form and I am setting the datasource in
> >>Page_Load
> >> Event and there are no errors generated, I can interrogate the DataTable
> >> and
> >> it returns row count, column count, data in rows, etc., but the DataGrid
> >> itself will NOT appear at all on the web form. Anybody know why?
> >>
> >> Thanks.
> >>
> >> Joe
> >> **********************
> >>
> >> Dim oConn As New OleDbConnection
> >> oConn.ConnectionString = ConnString 'generated outside Page_Load
> >> oConn.Open()
> >>
> >> Dim sSQL As String = "select * from REGISTRATION"
> >>
> >> Dim da As OleDbDataAdapter = New OleDbDataAdapter(sSQL, oConn)
> >>
> >> Dim ds As DataSet = New DataSet
> >> da.Fill(ds, "REGISTRATION")
> >> Me.DataGrid1.DataSource = ds.Tables("REGISTRATION")
> >> lblStatus.Text = ds.Tables(0).TableName & ";Columns = " &
> >> ds.Tables(0).Columns.Count.ToString
> >> lblStatus.Visible = True
> >>
> >> --
> >> Joe Baker

> >
> >

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to open an Access database object - Access Database Becomes Inaccessible Suzane Brandy Microsoft Access 2 21st Apr 2010 07:33 AM
Export Relationships Diagram for four new tables from test(developer) ms access database to production ms access database Bosiljka Kostić Microsoft Access Getting Started 1 14th Feb 2007 11:45 PM
Display Datagrid using MS Access database daudihus@gmail.com Microsoft ADO .NET 8 13th Jun 2005 02:33 PM
updating a MS Access 2000 Database through a dataset on a datagrid. Tom LaFontaine via .NET 247 Microsoft ADO .NET 1 19th May 2005 12:29 AM
updating a MS Access 2000 Database through a dataset on a datagrid. Tom LaFontaine via .NET 247 Microsoft ADO .NET 0 19th May 2005 12:09 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:14 PM.