SQL Queries

This is an open forum for any mojoPortal topics that don't fall into the other categories.

This thread is closed to new posts. You must sign in to post in the forums.
11/2/2009 10:53:28 AM
Gravatar
Total Posts 33

SQL Queries

Hello!

Is it possible to use "classic ASP" SQL queries in a Mojoportal page?
I have tried but it doesnt seems that the queries runs :(

 

11/2/2009 11:07:55 AM
Gravatar
Total Posts 18439

Re: SQL Queries

No it is not. mojoPortal is built on ASP.NET which is a completely different technology than Classic ASP.

11/2/2009 11:24:40 AM
Gravatar
Total Posts 33

Re: SQL Queries

Thanks!

For a newbee in ASP.NET - is it possible to build the same kind of SQL queries that in classic ASP?

11/2/2009 11:43:06 AM
Gravatar
Total Posts 18439

Re: SQL Queries

Yes, there are ways, I assume you want to databind some data into a grid or something.

Just do some googleing on ASP.NET GrdiView and SQLDataSource controls. Here is one example tutorial but there are lots out there.

Note however that this is not the way I do things in mojoPortal, I don't like to have data access code in the presentation (Web) layer. I generally only talk to business objects from the web code and the business objects in turn talk to the data layer to get data. Using things like SQLDataSource is a quick and dirty way to do things but not the best in terms of architecture. Still, for a beginner its probably the easiest way to get results. Note that you would have to add a connection string section to your Web.config, mojoportal itself uses a setting from appSettings but SqlDataSource can only use one from connectionstrings section like this:

<connectionStrings>

<add name="LocalSqlServer" connectionString="server=yourservername;UID=yourdatabaseusername;PWD=yourdatabaseuserpassword;database=yourdatabasename"

providerName="System.Data.SqlClient"

/>

</connectionStrings>

so you would copy the same connection string value from appSettings MSSQLConnectionString and put it there.

Hope it helps,

Joe

11/2/2009 2:19:58 PM
Gravatar
Total Posts 33

Re: SQL Queries

Thanks - again :)

But what kind of page do I put the code in - i tried to do a "code.aspx" and put that as a "fragment file" - but that didnt work :(

11/2/2009 2:23:45 PM
Gravatar
Total Posts 18439

Re: SQL Queries

You cannot do includes with ASP.NET, its nothing like classic asp

Start with the Hello World tutorial

http://www.mojoportal.com/hello-world-developer-quick-start.aspx

Hope it helps,

Joe

You must sign in to post in the forums. This thread is closed to new posts.