Connecting Tech Pros Worldwide Forums | Help | Site Map

Moving to ASP.Net from ColdFusion -- connecting to a database???

Alex
Guest
 
Posts: n/a
#1: Nov 19 '05
Hi all,

I've been writing in ColdFusion for about 6 years now, and now that
we've installed a Sharepoint Portal Server I'm finding that I need to
use ASP.Net to make database calls. I'm finding no good documentation
for someone who hasn't worked with ASP.Net...

In ColdFusion it's a very simple task to pull data from a database...
just setup the datasource in the CF Admin page and use something like
this:

<cfquery name="GetData" datasource="MyDS">
select Firstname, Lastname from Names
</cfquery>

<cfoutput query="GetData">
#Firstname# #lastname#<br>
</cfoutput>

But when I try to see how to do this in ASP.Net I found this page on
MS's website: http://tinyurl.com/9vk2c

And without even giving any code examples here's what it says:

To access SQL databases from ASP.NET
1. Create a database connection using the SqlConnection class.
2. Select a set of records from the database using the
SqlDataAdapter class.
3. Fill a new DataSet using the SqlDataAdapter class.
4. If you are selecting data from a database for non-interactive
display only, it is recommended that you use a read-only, forward-only
SqlDataReader (or OleDbDataReader for non-SQL databases) for best
performance. When using a SqlDataReader, select the records using a
SqlCommand query and create a SqlDataReader that is returned from the
SqlCommand object's ExecuteReader method.

In some cases, such as when you want to sort or filter a set of
data, you might also want to create a new DataView based on a DataSet
for the desired table.
5. Bind a server control, such as a DataGrid, to the DataSet,
SqlDataReader, or DataView.

Why is everything Microsoft touches so freakin' complicated? Is there
not some sample code I can use that I can simply change my database
name, server, and login info then create some loop to cycle through my
data? I'm not writing an entire application, just making a call to a
database to show on the screen via a DWP page.. I've stayed away from
Microsoft's programming languages thus far because they are so bloated
compared to CF, PHP, and even standard C++ when talking about app
development, but now I'm finding I have to use ASP.Net or similar to
create database requests with SPS. Am I wrong? Is it simpler them
MS's tech docs show it to be? Do I need to get a Masters in CS to
learn this mess?

Thanks for any comments or suggestions... it's gotta be simpler then
this!

Sam Alex


tom pester
Guest
 
Posts: n/a
#2: Nov 19 '05

re: Moving to ASP.Net from ColdFusion -- connecting to a database???


Hi Alex,

I don't master CF but I think you are correct that ASP.NET requires more
code and more 'mental model'.

I also read posts that say ASP.NET with its controls (that tend to go toward
things you are doing in CF) are too simple and inflexible.
These guys want to do everything on a lower level.

Then there are people who want to do everyting as declative as possible (CF
programmers fall into this category I presume) and sigh with every extra
line of code they think isn't necessary.
It isn't necessary as long as the problem you are trying to solve is general
enough (the majority of the cases IMO).

ASP.NET is trying to place itslef between these 2 approaches and tries to
give the best of both worlds. In the old classic asp days you woul have even
more sighed :)

Check out this tutorial if you still want to bite the bullet :
http://aspnet.4guysfromrolla.com/articles/040502-1.aspx

The first part will get you started and the rest of the chapters will show
you more datagrid power.


Cheers,
Tom Pester
[color=blue]
> Hi all,
>
> I've been writing in ColdFusion for about 6 years now, and now that
> we've installed a Sharepoint Portal Server I'm finding that I need to
> use ASP.Net to make database calls. I'm finding no good documentation
> for someone who hasn't worked with ASP.Net...
>
> In ColdFusion it's a very simple task to pull data from a database...
> just setup the datasource in the CF Admin page and use something like
> this:
>
> <cfquery name="GetData" datasource="MyDS">
> select Firstname, Lastname from Names
> </cfquery>
> <cfoutput query="GetData">
> #Firstname# #lastname#<br>
> </cfoutput>
> But when I try to see how to do this in ASP.Net I found this page on
> MS's website: http://tinyurl.com/9vk2c
>
> And without even giving any code examples here's what it says:
>
> To access SQL databases from ASP.NET
> 1. Create a database connection using the SqlConnection class.
> 2. Select a set of records from the database using the
> SqlDataAdapter class.
> 3. Fill a new DataSet using the SqlDataAdapter class.
> 4. If you are selecting data from a database for non-interactive
> display only, it is recommended that you use a read-only, forward-only
> SqlDataReader (or OleDbDataReader for non-SQL databases) for best
> performance. When using a SqlDataReader, select the records using a
> SqlCommand query and create a SqlDataReader that is returned from the
> SqlCommand object's ExecuteReader method.
>
> In some cases, such as when you want to sort or filter a set of
> data, you might also want to create a new DataView based on a DataSet
> for the desired table.
> 5. Bind a server control, such as a DataGrid, to the DataSet,
> SqlDataReader, or DataView.
> Why is everything Microsoft touches so freakin' complicated? Is there
> not some sample code I can use that I can simply change my database
> name, server, and login info then create some loop to cycle through my
> data? I'm not writing an entire application, just making a call to a
> database to show on the screen via a DWP page.. I've stayed away from
> Microsoft's programming languages thus far because they are so bloated
> compared to CF, PHP, and even standard C++ when talking about app
> development, but now I'm finding I have to use ASP.Net or similar to
> create database requests with SPS. Am I wrong? Is it simpler them
> MS's tech docs show it to be? Do I need to get a Masters in CS to
> learn this mess?
>
> Thanks for any comments or suggestions... it's gotta be simpler then
> this!
>
> Sam Alex
>[/color]


Sam ALex
Guest
 
Posts: n/a
#3: Nov 19 '05

re: Moving to ASP.Net from ColdFusion -- connecting to a database???


Hi Tom,

I apologize for my initial email being so tactful, but I get frustrated
when working with Microsoft languages and using their online help. The
URL you sited helps, and I think that's a great starting point, so
thanks a million for that!

Basically in a nutshell what I've written over the last 6+ years in
ColdFusion is a content management and document management system for
our Intranet, and though it works rather well, SPS has some features we
like... like being integrated into MS Office, Exchange, and Active
Directory. The only problem is we have so many custom 'dashboards' and
applications I've created in ColdFusion that it'll take time to
transpose these to ASP.Net (or whatever language is needed on SPS).

You're right in that CF and ASP.Net are on two ends of the spectrum, and
with me knowing PHP as well I can see how having more options is
helpful... but MS doesn't help much when someone like me who has
experience programming for web but just needs to learn the syntax of
ASP.Net (or whatever language) tries to learn.

The tutorial you sited shows <script language="vb" runat="server"> which
is one of the missing links for me... MS's tech docs showed all these
pieces of code, but no starting point on where to use them with asp.net.
This helps tie it all together.

And finally, to write asp.net apps or even to bundle C# or VB into
ASP.Net apps (like using the <script> tag above), do I need Visual
Studio.Net? We've already spent a pretty penny on SPS and on SPS books
assuming with the cost we had some native, outta the box method to query
databases, but we don't have another $600 to spend on VS.Net.

Thanks again for your help.. finally I see a pinpoint of light at the
end of the tunnel :)

Sam Alex



"tom pester" wrote:[color=blue]
>Hi Alex,
>
>I don't master CF but I think you are correct that ASP.NET requires[/color]
more[color=blue]
>code and more 'mental model'.
>
>I also read posts that say ASP.NET with its controls (that tend to go[/color]
toward[color=blue]
>things you are doing in CF) are too simple and inflexible.
>These guys want to do everything on a lower level.
>
>Then there are people who want to do everyting as declative as possible[/color]
(CF[color=blue]
>programmers fall into this category I presume) and sigh with every[/color]
extra[color=blue]
>line of code they think isn't necessary.
>It isn't necessary as long as the problem you are trying to solve is[/color]
general[color=blue]
>enough (the majority of the cases IMO).
>
>ASP.NET is trying to place itslef between these 2 approaches and tries[/color]
to[color=blue]
>give the best of both worlds. In the old classic asp days you woul have[/color]
even[color=blue]
>more sighed :)
>
>Check out this tutorial if you still want to bite the bullet :
>http://aspnet.4guysfromrolla.com/articles/040502-1.aspx
>
>The first part will get you started and the rest of the chapters will[/color]
show[color=blue]
>you more datagrid power.
>
>
>Cheers,
>Tom Pester
>[/color]

--
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com
Juan T. Llibre
Guest
 
Posts: n/a
#4: Nov 19 '05

re: Moving to ASP.Net from ColdFusion -- connecting to a database???


Hi, Sam.

You'll find the QuickStart Tutorials to be very
helpful when learning the basics of ASP.NET :

http://samples.gotdotnet.com/quickstart/aspplus/

There's coding examples there for just about all the basic ASP.NET operations.




Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Espaņol
Ven, y hablemos de ASP.NET...
======================

"Sam ALex" <samalex@gmail.com> wrote in message
news:uCE9%230LqFHA.1024@TK2MSFTNGP09.phx.gbl...[color=blue]
> Hi Tom,
>
> I apologize for my initial email being so tactful, but I get frustrated
> when working with Microsoft languages and using their online help. The
> URL you sited helps, and I think that's a great starting point, so
> thanks a million for that!
>
> Basically in a nutshell what I've written over the last 6+ years in
> ColdFusion is a content management and document management system for
> our Intranet, and though it works rather well, SPS has some features we
> like... like being integrated into MS Office, Exchange, and Active
> Directory. The only problem is we have so many custom 'dashboards' and
> applications I've created in ColdFusion that it'll take time to
> transpose these to ASP.Net (or whatever language is needed on SPS).
>
> You're right in that CF and ASP.Net are on two ends of the spectrum, and
> with me knowing PHP as well I can see how having more options is
> helpful... but MS doesn't help much when someone like me who has
> experience programming for web but just needs to learn the syntax of
> ASP.Net (or whatever language) tries to learn.
>
> The tutorial you sited shows <script language="vb" runat="server"> which
> is one of the missing links for me... MS's tech docs showed all these
> pieces of code, but no starting point on where to use them with asp.net.
> This helps tie it all together.
>
> And finally, to write asp.net apps or even to bundle C# or VB into
> ASP.Net apps (like using the <script> tag above), do I need Visual
> Studio.Net? We've already spent a pretty penny on SPS and on SPS books
> assuming with the cost we had some native, outta the box method to query
> databases, but we don't have another $600 to spend on VS.Net.
>
> Thanks again for your help.. finally I see a pinpoint of light at the
> end of the tunnel :)
>
> Sam Alex
>
>
>
> "tom pester" wrote:[color=green]
>>Hi Alex,
>>
>>I don't master CF but I think you are correct that ASP.NET requires[/color]
> more[color=green]
>>code and more 'mental model'.
>>
>>I also read posts that say ASP.NET with its controls (that tend to go[/color]
> toward[color=green]
>>things you are doing in CF) are too simple and inflexible.
>>These guys want to do everything on a lower level.
>>
>>Then there are people who want to do everyting as declative as possible[/color]
> (CF[color=green]
>>programmers fall into this category I presume) and sigh with every[/color]
> extra[color=green]
>>line of code they think isn't necessary.
>>It isn't necessary as long as the problem you are trying to solve is[/color]
> general[color=green]
>>enough (the majority of the cases IMO).
>>
>>ASP.NET is trying to place itslef between these 2 approaches and tries[/color]
> to[color=green]
>>give the best of both worlds. In the old classic asp days you woul have[/color]
> even[color=green]
>>more sighed :)
>>
>>Check out this tutorial if you still want to bite the bullet :
>>http://aspnet.4guysfromrolla.com/articles/040502-1.aspx
>>
>>The first part will get you started and the rest of the chapters will[/color]
> show[color=green]
>>you more datagrid power.
>>
>>
>>Cheers,
>>Tom Pester
>>[/color]
>
> --
> Sent via .NET Newsgroups
> http://www.dotnetnewsgroups.com[/color]


Sam ALex
Guest
 
Posts: n/a
#5: Nov 19 '05

re: Moving to ASP.Net from ColdFusion -- connecting to a database???


Hi Juan,

This link along with the link Peter posted both help you tremendously!
My next step is getting some test pages written, then the fun part --
getting these to work with Sharepoint Portal as DWP files :)

Thanks again!

Sam Alex


"Juan T. Llibre" wrote:[color=blue]
>Hi, Sam.
>
>You'll find the QuickStart Tutorials to be very
>helpful when learning the basics of ASP.NET :
>
>http://samples.gotdotnet.com/quickstart/aspplus/
>
>There's coding examples there for just about all the basic ASP.NET[/color]
operations.[color=blue]
>
>
>
>
>Juan T. Llibre
>ASP.NET MVP
>http://asp.net.do/foros/
>Foros de ASP.NET en Espaņol
>Ven, y hablemos de ASP.NET...
>======================
>[/color]

--
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com
Mythran
Guest
 
Posts: n/a
#6: Nov 19 '05

re: Moving to ASP.Net from ColdFusion -- connecting to a database???


See comments in-line:


"Sam ALex" <samalex@gmail.com> wrote in message
news:uCE9%230LqFHA.1024@TK2MSFTNGP09.phx.gbl...[color=blue]
> Basically in a nutshell what I've written over the last 6+ years in
> ColdFusion is a content management and document management system for
> our Intranet, and though it works rather well, SPS has some features we
> like... like being integrated into MS Office, Exchange, and Active
> Directory. The only problem is we have so many custom 'dashboards' and
> applications I've created in ColdFusion that it'll take time to
> transpose these to ASP.Net (or whatever language is needed on SPS).
>[/color]

Just so ya know, ASP.Net is not a language. ASP.Net is a framework. The
code-behind, being C#, J#, C++, VB.Net are languages. Just letting ya know
so you can understand it all better...
[color=blue]
> You're right in that CF and ASP.Net are on two ends of the spectrum, and
> with me knowing PHP as well I can see how having more options is
> helpful... but MS doesn't help much when someone like me who has
> experience programming for web but just needs to learn the syntax of
> ASP.Net (or whatever language) tries to learn.[/color]

I see CF for those quick and dirty jobs, but for larger applications that
require n-tiers, more complex business logic, and a more flexible system, I
see ASP.Net being the hero (ok, overkill by using that term). But, get what
I mean?
[color=blue]
>
> The tutorial you sited shows <script language="vb" runat="server"> which
> is one of the missing links for me... MS's tech docs showed all these
> pieces of code, but no starting point on where to use them with asp.net.
> This helps tie it all together.
>[/color]
You should really learn more about ASP.Net before jumping in, but as you
have stated, I don't think you have the time. Anywho, there are two ways to
write ASP.Net. 1.) Using code-behind pages (which are compiled into class
assemblies), and 2.) Writing in-line server-side code, which is what you
posted above.

To use server-side code:

<script language="vb" runat="server">
VB.Net code here
</script>

To use the better (IMO) way, using code-behind pre-pre-compiled assemblies:
top of ASPX page, place the following:

<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="codebehindpath.vb" Inherits="Namespace.ClassName" %>

example:
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="index.aspx.vb"
Inherits="MCIS.Applications.Northwind.WebUI.index" %>

then you would place your ServerSide code into a text file named
"codebehindpath.vb" (named whatever, in my above example, it's
index.aspx.vb). This file will get compiled either by the .Net IDE or
command-line by you. Remember that since this is a server-side ASP.Net
code-behind file, you will not need the <script.../> tags.
[color=blue]
> And finally, to write asp.net apps or even to bundle C# or VB into
> ASP.Net apps (like using the <script> tag above), do I need Visual
> Studio.Net? We've already spent a pretty penny on SPS and on SPS books
> assuming with the cost we had some native, outta the box method to query
> databases, but we don't have another $600 to spend on VS.Net.
>[/color]
You do NOT need VS.Net to install or write .Net applications. All you need
VS.Net is to ease the burden of writing code and compiling. It is more of a
project manager and development studio than anything else. It doesn't even
contain the compiler. The compiler for .Net is free and is automatically
installed when you install the .Net framework. Most help on the Internet,
though, assumes you use the VS.Net ide (but in most cases, it doesn't
matter). The code examples come with a project file which is used in VS,
but you can compile them w/o VS.
[color=blue]
> Thanks again for your help.. finally I see a pinpoint of light at the
> end of the tunnel :)
>
> Sam Alex
>
>[/color]


I hope this has helped clear things up for ya a little :) In the end, I see
ASP.Net as a good solution for most problems, although there are better ways
to do things, ASP.Net is one way that will almost always work .. given
enough time and money, anything is possible [don't know who to quote].

Mythran

tom pester
Guest
 
Posts: n/a
#7: Nov 19 '05

re: Moving to ASP.Net from ColdFusion -- connecting to a database???


> And finally, to write asp.net apps or even to bundle C# or VB into[color=blue]
> ASP.Net apps (like using the <script> tag above), do I need Visual
> Studio.Net? We've already spent a pretty penny on SPS and on SPS
> books assuming with the cost we had some native, outta the box method
> to query databases, but we don't have another $600 to spend on VS.Net.[/color]

I got some good advice for you :
http://lab.msdn.microsoft.com/express/vwd/

"Visual Web Developer Express" is a great development tool that will assist
you greatly.
Its free for now and when its officialy released it will cost about 50$

Check out
http://lab.msdn.microsoft.com/vs2005...e/default.aspx
For all its capabilities.

(You can also check out the web matrix project at http://www.asp.net/webmatrix/default...dex=4&tabId=46
but I recomend VWD which I consider its succesor)

By doing this you are also using the next version of asp.net (version 2)
wich is very stable and will come out November.
It will eleminate some of the show stoppers that you will encounter in version
1 (no need to mention them cause you will avoid them)

Summary : you don't need VS.NET at all to make good ASP apps

I saw an answer to this post that recommends putting all the code in a seperate
file. Alhough this is good coding practice I wouldn't start with this approuch.
(look up " asp.net code behind page" if you are intrested later)

Now the important part. Your goal is to write for PSP wich I am not familiar
with unfortunatly. What are DWP files aneway?
I'm sure we can help you here all the same.


I always wanted to learn PHP ( and CF also). Maybe you can set me on my way
with PHP :)

Can you recommend some
- sites
- books
- tools

Cheers,
Tom Pester


tom pester
Guest
 
Posts: n/a
#8: Nov 19 '05

re: Moving to ASP.Net from ColdFusion -- connecting to a database???



http://msdn.microsoft.com/library/de...ideOutCh18.asp

Cheers,
Tom Pester
[color=blue][color=green]
>> And finally, to write asp.net apps or even to bundle C# or VB into
>> ASP.Net apps (like using the <script> tag above), do I need Visual
>> Studio.Net? We've already spent a pretty penny on SPS and on SPS
>> books assuming with the cost we had some native, outta the box method
>> to query databases, but we don't have another $600 to spend on
>> VS.Net.
>>[/color]
> I got some good advice for you :
> http://lab.msdn.microsoft.com/express/vwd/
>
> "Visual Web Developer Express" is a great development tool that will
> assist
> you greatly.
> Its free for now and when its officialy released it will cost about
> 50$
> Check out
> http://lab.msdn.microsoft.com/vs2005...line/default.a
> spx For all its capabilities.
>
> (You can also check out the web matrix project at
> http://www.asp.net/webmatrix/default...dex=4&tabId=46 but I
> recomend VWD which I consider its succesor)
>
> By doing this you are also using the next version of asp.net (version
> 2)
> wich is very stable and will come out November.
> It will eleminate some of the show stoppers that you will encounter in
> version
> 1 (no need to mention them cause you will avoid them)
> Summary : you don't need VS.NET at all to make good ASP apps
>
> I saw an answer to this post that recommends putting all the code in a
> seperate file. Alhough this is good coding practice I wouldn't start
> with this approuch. (look up " asp.net code behind page" if you are
> intrested later)
>
> Now the important part. Your goal is to write for PSP wich I am not
> familiar
> with unfortunatly. What are DWP files aneway?
> I'm sure we can help you here all the same.
> I always wanted to learn PHP ( and CF also). Maybe you can set me on
> my way with PHP :)
>
> Can you recommend some
> - sites
> - books
> - tools
> Cheers,
> Tom Peste[/color]


Closed Thread