Prev: pagemethods
Next: ASP PHP
From: JohnE on 29 Jan 2010 21:55 I am a newbie at this so I am spending time at night learning all I can of asp.net. I read the information on line plus in books and they make reference to sqldatasource. They also make reference to coding the connection, etc in C# in the code behind. I have a connection string in the webconfig file but my question pertains to the way to use it. It is getting confusing. What is the proper / best way to work with connection strings and all that goes it (da, dt, ds, etc), use a sqldatasource or thru code behind or both? And why? Thanks...John
From: Alexey Smirnov on 30 Jan 2010 12:19 On Jan 30, 3:55 am, JohnE <Jo...(a)discussions.microsoft.com> wrote: > I am a newbie at this so I am spending time at night learning all I can of > asp.net. I read the information on line plus in books and they make > reference to sqldatasource. They also make reference to coding the > connection, etc in C# in the code behind. I have a connection string in the > webconfig file but my question pertains to the way to use it. It is getting > confusing. What is the proper / best way to work with connection strings and > all that goes it (da, dt, ds, etc), use a sqldatasource or thru code behind > or both? And why? > > Thanks...John I always do this thru the code behind. It makes it easy for me. Using sqldatasource is more "declarative" than programmatic scenario. Depending on the requirements and experience sqldatasource could be a good advantage too.
From: JohnE on 30 Jan 2010 15:49 Thanks. It is an Access 2007 db that is getting converted over. It turns out not to be as large as first thought. About 6 - 8 people will be using it and it isn't that much of a complicated conversion. So the sqldatasource might be the simpliest method to use. Probably not so for the next one to convert. Now if I can only get the A2007 data over to sql server 2005 I would be happy. You wouldn't happen to have any good scripts to use? The sql import does not bring it over, that ssma2005 application will not bring all the tables, A2007 upsizing wizard is worthless. Anyway, thanks for the reply. John "Alexey Smirnov" wrote: > On Jan 30, 3:55 am, JohnE <Jo...(a)discussions.microsoft.com> wrote: > > I am a newbie at this so I am spending time at night learning all I can of > > asp.net. I read the information on line plus in books and they make > > reference to sqldatasource. They also make reference to coding the > > connection, etc in C# in the code behind. I have a connection string in the > > webconfig file but my question pertains to the way to use it. It is getting > > confusing. What is the proper / best way to work with connection strings and > > all that goes it (da, dt, ds, etc), use a sqldatasource or thru code behind > > or both? And why? > > > > Thanks...John > > I always do this thru the code behind. It makes it easy for me. Using > sqldatasource is more "declarative" than programmatic scenario. > Depending on the requirements and experience sqldatasource could be a > good advantage too. > . >
From: Mark Rae [MVP] on 30 Jan 2010 20:00 "JohnE" <JohnE(a)discussions.microsoft.com> wrote in message news:30FA1AA0-81F3-4142-9BB5-1D24AF9E4E8E(a)microsoft.com... > I am a newbie at this so I am spending time at night learning all I can of > asp.net. I read the information on line plus in books and they make > reference to sqldatasource. They also make reference to coding the > connection, etc in C# in the code behind. I have a connection string in > the > webconfig file but my question pertains to the way to use it. It is > getting > confusing. What is the proper / best way to work with connection strings > and > all that goes it (da, dt, ds, etc), use a sqldatasource or thru code > behind > or both? And why? I would suggest that you forget all about these "training wheels" controls and build yourself a DAL (data abstraction layer) based on the factory pattern. Microsoft's DAAB is a good place to start: http://www.microsoft.com/downloads/details.aspx?familyid=1643758B-2986-47F7-B529-3E41584B6CE5&displaylang=en This will allow you to support more than one RDBMS with the same DAL. Mine currently supports SQL Server, SqlCe, Jet (which some people call Access), Oracle and MySql. It can be dropped completely unmodified into any WinForms or WebForms project. -- Mark Rae ASP.NET MVP http://www.markrae.net
From: JohnE on 30 Jan 2010 23:27
"Mark Rae [MVP]" wrote: > "JohnE" <JohnE(a)discussions.microsoft.com> wrote in message > news:30FA1AA0-81F3-4142-9BB5-1D24AF9E4E8E(a)microsoft.com... > > > I am a newbie at this so I am spending time at night learning all I can of > > asp.net. I read the information on line plus in books and they make > > reference to sqldatasource. They also make reference to coding the > > connection, etc in C# in the code behind. I have a connection string in > > the > > webconfig file but my question pertains to the way to use it. It is > > getting > > confusing. What is the proper / best way to work with connection strings > > and > > all that goes it (da, dt, ds, etc), use a sqldatasource or thru code > > behind > > or both? And why? > > I would suggest that you forget all about these "training wheels" controls > and build yourself a DAL (data abstraction layer) based on the factory > pattern. > > Microsoft's DAAB is a good place to start: > http://www.microsoft.com/downloads/details.aspx?familyid=1643758B-2986-47F7-B529-3E41584B6CE5&displaylang=en > > This will allow you to support more than one RDBMS with the same DAL. Mine > currently supports SQL Server, SqlCe, Jet (which some people call Access), > Oracle and MySql. It can be dropped completely unmodified into any WinForms > or WebForms project. > > > -- > Mark Rae > ASP.NET MVP > http://www.markrae.net > > . > Thanks for the info. But training wheels are good for starters. Got to crawl before you can walk. Got to walk before you can run. And with what is being converted over, it is also a learning tool. John |