473,790 Members | 3,083 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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="MyD S">
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

Nov 19 '05 #1
7 1886
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
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="MyD S">
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

Nov 19 '05 #2
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:
Hi Alex,

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

I also read posts that say ASP.NET with its controls (that tend to go towardthings 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 (CFprogrammers fall into this category I presume) and sigh with every extraline of code they think isn't necessary.
It isn't necessary as long as the problem you are trying to solve is generalenough (the majority of the cases IMO).

ASP.NET is trying to place itslef between these 2 approaches and tries togive the best of both worlds. In the old classic asp days you woul have evenmore 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 showyou more datagrid power.
Cheers,
Tom Pester


--
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com
Nov 19 '05 #3
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" <sa*****@gmail. com> wrote in message
news:uC******** ********@TK2MSF TNGP09.phx.gbl. ..
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:
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


--
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com

Nov 19 '05 #4
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:
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...
============== ========


--
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com
Nov 19 '05 #5
See comments in-line:
"Sam ALex" <sa*****@gmail. com> wrote in message
news:uC******** ********@TK2MSF TNGP09.phx.gbl. ..
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).

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...
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.
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?

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.
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="cod ebehindpath.vb" Inherits="Names pace.ClassName" %>

example:
<%@ Page Language="vb" AutoEventWireup ="false" Codebehind="ind ex.aspx.vb"
Inherits="MCIS. Applications.No rthwind.WebUI.i ndex" %>

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.
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.
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.
Thanks again for your help.. finally I see a pinpoint of light at the
end of the tunnel :)

Sam Alex

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

Nov 19 '05 #6
> 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.


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
Nov 19 '05 #7

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

Cheers,
Tom Pester
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.

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

Nov 19 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

60
10107
by: English Teacher | last post by:
Which would be more useful to learn, PHP or COLDFUSION? I know Coldfusion is popular in the work force. Is PHP? Thanks!
6
8928
by: Hemant Shah | last post by:
Folks, I need to move HOME directory of an instance to another directory. What is the best way of doing it? Is changing password file enough? or dies DB2 store this info in it's own config? I am running UDB 8.2 on Linux and AIX. Thanks.
9
7279
by: Daven Thrice | last post by:
If I have a fairly big Access MDB, that is relational, and has, say, 100 objects (forms, reports, modules, etc.), what is the path to get this database "online". Is there a way to put the tables online and then distribute the front end to each user? What if I want to have all the forms and stuff online? How do you approach something like that? Is it a total rewrite with another tool?
4
2745
by: William Fields | last post by:
Hello, I'm trying to find out more information about ColdFusion and could not find what I'm looking for on Macromedia's website. My question has more to do with what ColdFusion is and how web services are supported. Specifically, I'd like to know: Is Coldfusion nothing more than an IIS extension like ASP.NET? Can Coldfusion and ASP.NET coexist on the same webserver?
1
6995
by: jesmi | last post by:
what is the connection string for coldfusion for connecting with ms access database? i need the connection string written in coldfusion. Thank you!! jesmi
8
2865
by: Chris Asaipillai | last post by:
Hi there I have some questions for those experienced Visual Basic 6 programmers out there who have made the transition from VB6 to Vb.net. How long did it take you to learn at least the basic elements of VB.net....so that you were confident to write a application from scratch. This wouldnt necessarily
1
4286
by: marcnz | last post by:
I have been charged of creating a coldfusion web site for our company. Our database has a ms sql 2005 backend and ms access frontend. Almost all tables are linked tables with the SQL database, except the temp tables needed at runtime that are in the ms access database. It will be easier for us to utilize the ms access queries and temp tables, so I set up a datasource on our web server and within the coldfusion administrator to point to the ms...
1
2281
by: SV | last post by:
Hello I am trying to consume web service written in ColdFusion from asp.net (VB) page. I am using ASP.Net 2.0. I have added web reference and defined instance of that web service and used one of its methods. But it gives me error : "Unable to automatically step into the server. Connecting to the server machine '10.21.13.13' failed. The Microsoft Visual Studio Remote Debugging Monitor (MSVSMON.EXE) does not appear to be running on the...
106
19835
by: bonneylake | last post by:
Hey Everyone, Well i don't know if my question should be in javascript/ajax or coldfusion, i figure this is more of a coldfusion question. But if this is in the wrong section let me know an all gladly delete my question an put it in the correct section. Well what i am trying to do is pretty simple. I have a input field and someone starts typing in a customer number. As they type in the customer number the drop down box is populated. They...
0
9512
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10419
Oralloy
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...
1
10147
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9987
tracyyun
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...
1
7531
isladogs
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...
0
6770
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();...
0
5424
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...
0
5552
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2910
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.