Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 26th, 2012, 02:57 PM
Friend of Wrox
 
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
Smile use mysql and linux

Hello Imar,
Can this book be used with mysql database as well without changing any single word of code at all?
Also can the site developed be run on linux as well as it runs on windows?

Please respond.
Thanks
 
Old February 26th, 2012, 08:16 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

No, you can't run it as-is using MySQL. This database is supported in .NET, but requires different controls and SQL statements. Also, you can't run the PlanetWrox Entity Framework.

There's an ASP.NET version for Linux available (called Mono) but as far as I know it supports ASP.NET only....

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old February 27th, 2012, 09:12 AM
Friend of Wrox
 
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
Smile

Thanks for reply,
Quote:
This database is supported in .NET, but requires different controls
Which controls are used?

Quote:
(called Mono) but as far as I know it supports ASP.NET only....
Which else is not supported?
 
Old February 27th, 2012, 11:21 AM
Friend of Wrox
 
Join Date: Nov 2009
Posts: 156
Thanks: 13
Thanked 16 Times in 16 Posts
Smile

Hi Sophia

You can use System.Data.MySqlClient instead of System.Data.SqlClient
dll file is published by Oracle

MySqlConnection in place of SqlConnection
MySqlCommand in place of SqlCommand
etc

if you want to use database objects independent to db type, you can use the base class:

DbConnection conn = new DbConnection(connectionString);
conn.Open();
and other codes

but you should manage the connectionString with attention to db type. maybe below codes:

Code:
DbConnection GetConnection(){
   string dbType = System.Configuration.ConfigurationSettings.AppSettings("dbType");
switch(dbType){

case "sql":
    return new System.Data.SqlConnection(sqlConnectionString);
case "mysql":
   return new System.Data.MySqlConnection(mySqlConnectionString);

}

return new DbConnection(defaultConnectionString);
}


// otherwhere
DbConnection conn = GetConnection();
DbCommand cmd = conn.GetCommand();
// other codes here
what's your idea Imar?
__________________
happy every time, happy every where

Reza Baiat
 
Old February 28th, 2012, 01:09 PM
Friend of Wrox
 
Join Date: Nov 2009
Posts: 156
Thanks: 13
Thanked 16 Times in 16 Posts
Smile

Hi sophia

I put MySql assemblies to my web storage area. you can download it:

http://rezabaiat88.persiangig.com/ot...Assemblies.rar
__________________
happy every time, happy every where

Reza Baiat





Similar Threads
Thread Thread Starter Forum Replies Last Post
How I will Install mySql in linux environment(pls rashmipant MySQL 1 October 24th, 2006 05:22 PM
mysql + JDBC + Linux silver_cuts Java Databases 2 March 23rd, 2006 09:28 AM
Connecting to MySQL from .NET on Linux and Windows jacob MySQL 1 February 5th, 2005 06:08 PM
mysql connection failed in linux kalai JSP Basics 0 December 14th, 2004 03:40 AM
problem with PHP - MYSQL in LINUX cnilashis PHP How-To 3 August 18th, 2003 02:24 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.