A
Alex
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
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