DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Thu, 16 Aug 2007 09:57:42 -0700,    posted on: microsoft.public.dotnet.framework.aspnet        back       

Thread Index
  1    Tina
          2    Ladislav Mrnka
                 3    Tina


sqldatasource to fill a datatable   
Can I use a sqlDataSource to fill a datatable in code?  How?
Thanks,
T
Date:Thu, 16 Aug 2007 09:57:42 -0700   Author:  

RE: sqldatasource to fill a datatable   
Hi Tina,
SqlDataSource is component used for databinding. If you need to fill 
DataTable in your code use SqlDataAdapter instead.

DataTable table = new DataTable();
using (SqlConnection conn = new SqlConnection(myConnectionString))
{
  SqlDataAdapter adapter = new SqlDataAdapter();
  adapter.SelectCommand = new SqlCommand("some database query", conn); 
  adapter.Fill(table);
}

Best regards,
Ladislav

"Tina" wrote:


> Can I use a sqlDataSource to fill a datatable in code?  How?
> Thanks,
> T 
> 
> 
> 
Date:Thu, 16 Aug 2007 18:18:58 -0700   Author:  

Re: sqldatasource to fill a datatable   
I'm aware of what you are saying.
My question stands.
T

"Ladislav Mrnka"  wrote in message 
news:61307DEC-64FB-45D0-9D00-2D0E61A195ED@microsoft.com...

> Hi Tina,
> SqlDataSource is component used for databinding. If you need to fill
> DataTable in your code use SqlDataAdapter instead.
>
> DataTable table = new DataTable();
> using (SqlConnection conn = new SqlConnection(myConnectionString))
> {
>  SqlDataAdapter adapter = new SqlDataAdapter();
>  adapter.SelectCommand = new SqlCommand("some database query", conn);
>  adapter.Fill(table);
> }
>
> Best regards,
> Ladislav
>
> "Tina" wrote:
>
>> Can I use a sqlDataSource to fill a datatable in code?  How?
>> Thanks,
>> T
>>
>>
>> 
Date:Fri, 17 Aug 2007 15:20:38 -0700   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us