Forum Moderators: open
Useful string functions seemed to have been removed and database query handling is just so cumbersome as to be almost unusable.
It also seems like you have to everything in a convoluted manner.
Its like microsoft took the worst bits of ASP (that **** global.asa file and its ilk) and built a whole new framework about them.
(Guess who's been having a bad day with .Net sites today)
They have so many complex classes. The sql server stuff makes DB integration take no time at all.
However, it was WELL worth it for just a few of the new features in ASP.NET. I can't begin to describe how much the cache object alone has helped.
I like those starter kits, we may well be able to use some of them in our developments.
The difficulty we had is that we effectively have their equivalents for standard ASP, lots of standard code segments, db connectors, error trappers, input validators and the like. Each of our attempts to do the same with dotnet seems to have ended up with more code and worse performance. (p.s. we never used the global.asa file for ASP development, it also seemed very cumbersome.)
Take the time to try the different options out, dig in for a few months and write a project or two but definitely get some form of training, even if it's a video because there are huge (emphasize HUGE) pitfalls to scalability and stability if you do things the wrong way. Used as it's intended, which is completely different from classic ASP, it's more horsepower and functionality than you can find anywhere.
I used to be afraid of it, now I couldn't live without it.
You need to use classes that are ready to use
Connect = New OleDbConnection
Adapter = New OleDbDataAdapter
ClassyDS = New DataSet
SelectStatement = "Stored Procedure "
ConnectString = ConfigurationSettings.AppSettings("ConnStr")
Connect.ConnectionString = ConnectString
Adapter.SelectCommand = New OleDbCommand(selectStatement,Connect)
Adapter.SelectCommand.Connection.Open
Adapter.Fill(ClassyDS, "ShoppingBasket")
ASP DB Connection
set objConn = Server.CreateObject ("ADODB.Connection")
connString = "DRIVER={SQL Server};SERVER=****.****.****.xxx;UID=uid;PWD=pwd;DATABASE=dbname"
objConn.Open connString
strExec = "StoredProcedure"
Set RSData = TMConn.Execute(strExec)
In the second example we just include everything execpt the strExec line
Try something like this:
Dim Connect As New SqlConnection(ConfigurationSettings.AppSettings("ConnStr"))
Dim Adapter As New SqlDataAdapter("Stored Procedure", Connect)
Dim ClassyDS As New DataSet
objConn.Open()
Adapter.Fill(ClassyDS, "ShoppingBasket")
There are many overloads for the methods and functions in the .Net libraries so these things could be done in dozens of ways.
Also, just curious, in your ASP.Net example you are using OLEDBConnection, and in your ASP.Classic expample you are using a SQL Server connection string. If you are using SQL Server with your .Net app you should try to use the System.Data.SQLClient libraries as they are optimized for use with SQL Server.
Dim DBConn As New SqlConnection(ConnectString)
DBConn.Open()
Dim objCommand As New SqlCommand(selectStatement or stored procedure name,DBConn)
Dim objReader As SqlDataReader
objCommand.CommandType = CommandType.StoredProcedure
objReader = objCommand.ExecuteReader()
While objReader.Read
'Do your work.......
End While
If you want inline SQL instead of Stored Proc..
objCommand.CommandType = CommandType.Text