SQL > My SQL

I have a problem, my asp.net page wants to connect to the sql server, but it has to be the mysql. How can I solve this problem?

This is my code:
<%@ page explicit="true" language="VB" debug="true" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.Odbc" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<html>
<script runat="server">
sub page_load(sender as object, e as eventargs)
If Not IsPostBack Then
dim connect as sqlconnection = new sqlconnection
dim adapter as sqldataadapter = new sqldataadapter
dim gboekds as dataset = new dataset
Dim connectString, selectstatement as string
dim category as string
selectstatement = "select * from gastenboek"

ConnectString = "Data Source=localhost;Database=solidsjakie;User ID=solidsjakie@localhost;Password=secret"
connect.connectionstring = connectstring
adapter.selectcommand = new sqlcommand(selectstatement, connect)
adapter.selectcommand.connection.open
adapter.fill(gboekds,"gastenboek")
gastenboekgrid.DataSource = gboekds.Tables("gastenboek")
page.databind
end if
end sub
sub plaats_click(sender as object, e as eventargs)
response.redirect("gboekplaats.aspx")
end sub
</script>
0
solidesjakie
3/23/2004 12:01:11 PM
asp.net.mysql 1929 articles. 0 followers. Follow

11 Replies
1060 Views

Similar Articles

[PageSpeed] 10

There are a lot of problems with your code, but the main problem is that you are trying to use the System.Data.SqlClient with MySql. This namespace can ONLY be used with MS Sql Server.

Check this http://www.bytefx.com/DotData.aspx for a MySql Library written in managed code for the .Net framework.
Regards

Andre Colbiornsen
---------------------------------
Seventh Day
Råbygatan 1A,
SE-223 61 Lund
Sweden
Mob.: +46-(0)708-97 78 79
Mail: info@seventhday.se
--------------------------------
0
adec
3/23/2004 12:36:45 PM
I know there are problems with my code, im new with asp.net.

On the website of bytefx.com you mentioned i cannot find an answer to this problem. Which namespace should i use. The website is running on a server of a friend. This is a windows 2003 server. My Sql is up and running, i can access it with phpbb.
If I have the namespace i have to use i can go on debugging my code. Can you give it to me. The only language i understand a little is VB.Net. I have the book ASP.NET for dummies. There is only discribed how to access an access db or SQl server.
And yes, my english is fantastic, im from Holland.
0
solidesjakie
3/23/2004 12:54:42 PM
Download the Windows Installer from the website I mentioned. Install it and read the manual. You can then use the ByteFX.Data.MySqlClient Namespace with all the inherent Classes such as:

MySqlCommand Class
MySqlConnection Class
MySqlDataAdapter
MySqlDataReader
MySqlParameter
MySqlTransaction
etc.
Regards

Andre Colbiornsen
---------------------------------
Seventh Day
Råbygatan 1A,
SE-223 61 Lund
Sweden
Mob.: +46-(0)708-97 78 79
Mail: info@seventhday.se
--------------------------------
0
adec
3/23/2004 1:19:57 PM
I have downloaded ByteFX. I have made a table in my database and filled it with some data.

Now i want to connect to mysql through asp.net, but i get an error when importing the namespace of Byte FX.
<%@ Page Explicit="true" Language="VB" Debug="true" %>
<%@ import Namespace="ByteFX.Data.MySqlClient" %>
<html>
<head>
</head>
<body>
Test
</body>
</html>
This is the error i get on my server:
http://www.sanderdelange.nl/mysql.aspx
0
solidesjakie
3/28/2004 12:21:25 PM
If you haven't done so, you should create a folder named /bin in you Web Application. Drop a copy of the ByteFX .dll in the /bin folder.
Regards

Andre Colbiornsen
---------------------------------
Seventh Day
Råbygatan 1A,
SE-223 61 Lund
Sweden
Mob.: +46-(0)708-97 78 79
Mail: info@seventhday.se
--------------------------------
0
adec
3/28/2004 12:28:32 PM
thanks, now i am 1 step further

i think dim connectionstring as string = "provider=mysqloledb;uid=solidsjakie;pwd=secret" & "data source=localhost;initial catalog=solidsjakie;" has some errors, can you help me get this error free.
If this is error free, then the problem i think it is it still wants to connect to the sql server, and it needs to connect to mysql server.
www.sanderdelange.nl/mysql.aspx
this is now my test code:
<%@ Page Explicit="true" Language="VB" Debug="true" %>
<%@ import Namespace="ByteFX.Data.MySqlClient" %>
<html>
<script runat="server">
dim connect as mysqlconnection = new mysqlconnection
dim connectionstring as string = "provider=mysqloledb;uid=solidsjakie;pwd=secret" & "data source=localhost;initial catalog=solidsjakie;"
dim cmdselectbericht as mysqlcommand = new mysqlcommand
dim mysqlstring as string = "select naam, bericht from gastenboek"
dim dtrgastenboek as mysqldatareader
sub page_load()
connect.open()
cmdselectbericht = new mysqlcommand(mysqlstring, connect)
dtrgastenboek = cmdselectbericht.executereader()
lblberichten.text="De volgende berichten zijn geplaatst (naam, bericht)"
while dtrgastenboek.read()
lblberichten.text &="<br>*" & trim(dtrgastenboek("naam")) & "<br>" & dtrgastenboek("bericht")
end while
dtrgastenboek.close()
connect.close()
end sub
</script>
<head>
</head>
<body>
Test
<form runat="server">
<asp:label id="lblberichten" runat="server" />
</form>
</body>
</html>
0
solidesjakie
3/28/2004 8:02:14 PM

"data source=localhost;database=solidsjakie;user id=root;password=yourpass"
this must be conn string.
regards,
Mandar................
Imagination is important than Knowledge.

.............................................................

Mandar
0
mandaroak
4/10/2004 8:59:07 PM
Thanks. But i got the string from another person already.

Now i have a new problem.
I want to password secure a page with passwords from the database.
The string contains the right value, but somehow the = wont work properly.
sub wachtwoord_click(sender as object, e as eventargs)
if wachtwoordchk = txtwachtwoordprofiel.text then
panel1.visible="false"
panel2.visible="true"
else
messagelbl.text="Wachtwoord is onjuist"
end if

wachtwoordchk is declared as string and as i said contains the right password. How can i get this to work?
0
solidesjakie
4/11/2004 1:36:41 PM
I really cannt get your proble ??? 

(if wachtwoordchk = txtwachtwoordprofiel.text then
panel1.visible="false"
panel2.visible="true"
else
messagelbl.text="Wachtwoord is onjuist"
end if) ------------------ > Is your password stored in "wachtwoordchk"

Get me explanetion of your if Condition.
that checks password from database.
Try this -->
CommandString = "Select Password From DataBase where PasswordField = " & _ txtwachtwoordprofiel.text
in some of my projects I have created tha methods which returns true or false flags.
as by checking passwords from database
if(ChkPassMethod(string Password)
{
acess granted
}
else
{
Acess denied
}
Like this and code is writened in "chkPassMethod(string Password)"
where i have used MySQLDataAdapter, DataSet, ConnString And CommString...
News >>>>>>>>>> Check out www.webmatrixhosting.net Fro free hosting of your asp.net pages with sql server
Mandar
Imagination is important than Knowledge.

.............................................................

Mandar
0
mandaroak
4/13/2004 11:34:37 AM
wachtwoordchk contains the password.

If I make an <%=wachtwoordchk%> in the body then the password is viewed. But if I use this code then the right password is to type nothing at all in the page.
0
solidesjakie
4/13/2004 1:41:05 PM
Then What ????????
Imagination is important than Knowledge.

.............................................................

Mandar
0
mandaroak
4/15/2004 9:00:38 AM
Reply:

Similar Artilces:

Sql Server 2000->->->->->Data->->->-> Sql Server 2005
How can i migrate data from Sql Server 2000 to  Sql Server 2000 A backup file of SQL 2000 can be restored on SQL 2005   ThanksMark post(s) as "Answer" that helped youElectronic ScrewWebsite||Blog||Dub@i.net...

SQL Server Express >>> SQL Server
Hi SQL Server gurus I have developed a web-site using SQL Server Express -- mainly due to the open licence.  Now, when I look at the hosting companies, I see that some of them do not support SQL Server Express, allegedly due to performance issues.  Is this a valid argument?  In short, I am trying to find out whether SQL Server Express is good enough for me -- because it definitely seems to do what I want it to do -- OR should I be seriously thinking of upgrading as SQL Server Express will give me problems down the road?  Will it be able to take the load when site tr...

Recommendation
Hiya, I'm looking for some quick advice on how to achieve a task I've been trying to do. The situation: I run a script on my various SQL Servers (2000 and 2005). The script's output is an XML file. (I chose XML because the majority of the servers are on their own domains with different firewall rules and what not, so linking al servers was not an option). I also created an XSD file (booooooooring), which I still need to link to all the tables I created in a central SQL (for now 2000) Server. So I have an x-amount of XML files in a folder, and I will need to import those one by one. So f...

Sql, Sql express, Access or mysql for data
If this has been discussed before i apologise as i am fairly new to the asp forum and was not sure where to search for threads. I am upgrading to a new web plan that supports asp and i noticed that godaddy supports all of the above databases.  I was curious if there are any advantages to using one db over the others as far as web is concerned?  What i am looking to do is handle guestbook,  logins for registered users which would control access to certain downloads and possibly pages as well.  And it was also advised that i look into using a database to store and d...

Problems SQL Server -> SQL Anywhere
We have a strange problem when moving from MS SQL Server to SQL Anywhere. Can anyone help us with this problem Environment: Windows XP Sp1 Visual C++ 6.0 Adaptive Server Anywhere 8.0 ODBC driver 8.00.01.2600 Problem: I have derived a recordset class from CRecordset, and is using bulk row fetching. The data from the database is fetched in batches of 25 rows (default recordset size). If I terminate the operation when x rows are handled, the remaining (25-x) rows will turn up in the first batch when I restart the operation. All is well so far, but the first batch will hold ...

SQL Server Reporting Services for SQL SERVER 2000 AND Visual Studio.NET 2005 .NET 2.0
Hi, Which version of SQl Server Reporting Services will work with SQL SERVER 2000 in pararrel with ASP.NET 2.0 (.NET 2.0 framework)?  Thanks, Azam HighOnCodingWanna get high! Hi, Okay I got the answer. Yes, we can use the SQL SERVER 2005 Reporting Services with SQL SERVER 2000. HighOnCodingWanna get high! ...

SQL Anywhere for QNX -> SQL Anywhere for NT
Hello! I have a system (local server with http-server and Sybase SQL Anywhere) on QNX - several cgi-programs written on Watcom C with embedded SQL. Now I want to try to move all programs to Win NT. But I don't have time to entirely rewrite all the programs. Also currently I don't have opportunity to try SQL Anywhere for NT. So before I begin to experiment I want to ask some questions. First of all, I want to try to recompile all my cgi-programs with Watcom C for DOS using SQL Anywhere for NT sql-preprocessor. (btw, I don't use any qnx-specific functions in my programs). ...

Tool to migrate from MS SQL -> Sybase SQL?
Is there a simple tool (besides bcp) to move from Microsoft SQL Server to Sybase SQL Server? If yes, where can I find it? Thanks in advance, Bas Kroes Bas.Kroes@Object.Nl Bas wrote: > > Is there a simple tool (besides bcp) to move from Microsoft SQL Server to > Sybase SQL Server? If yes, where can I find it? > When you're using an old version of Microsoft (4.x) you can upgrade it to Sybase. I don't now if this is possible with newer versions too.. But on the other hand: it is not very difficult to generate a script to bcp out and in all you tables. W...

SQL A and SQL Server
Hi I heard SQL Server used to be owned by Watcom is this true? Is SQL Anywhere, therefore, similar to SQL Server? -- Regards, John Not quite true. SQL Anywhere was created by Watcom. SQLServer was created by Sybase, and Microsoft licensed the technology. So MSSQL and ASE have common roots, not SQLAnywhere. -- Paul Horan[TeamSybase] "John Kingan" <john.kingan@abibuildingdata.com> wrote in message news:40d82aa1$1@forums-1-dub... > Hi I heard SQL Server used to be owned by Watcom is this true? Is SQL > Anywhere, therefore, similar to SQL Ser...

SQL Express to SQL ?
I am developing a site using the express edition of all tools (VWD and SQL Express).  I want to use GoDaddy hosting and was wondering if I will be able to effectively put my SQL database and website up on their hosting even though it was developed via Express edition of Microsoft programs?...

sql or my sql query
hi,in my database  i have the two tables...1)programs                                2)reservedin the programs...two fields 1)program id           2)maxseats................these details wil be entered by adminin the reserved table  two fileds ..1)PRogramid        2)statusmy requirement is .. i need the available seats..meansif any body is intersted in  any program...they wil select the program...then status becomes approved(1)..then i need the o/p as ...

Help! How do I create an SQL database on my machine? + Access -> SQL ??
According to my technical support for web hosting, for database format they only use "MS SQL" operating on a windows system, usualy clients create they're sites on their local machines using "MS SQL". I'm just wondering..... Is 'MS SQL' free? where can I get it? I also have the option of creating the site round an access databse but I'm worried about the security issues, do you think it would be wise to use access? Is it easy to convert a site written in ASP.NET&ACCESS into a site using ASP.NET&"ms sql"? because then I could code a sit...

Strange difference between SQL from .Net and SQL within stored proc
Hi, I am trying to fill a DataGrid with random records from my database. It thought I had found a way to randomly select records using SQL. So I built a stored procedure in Access and sure enough, it returns a random set of records. Whe I tried to call this from my app, it kept returning the same set of records. So I copied and pasted the SQL into the app (code below) but it made no difference. Could anyone tell me why this wouldn't work? <%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" %><%@ Import Namespace="System.Data" %><%@ Import Namespace="...

SQL >>> datediff in access 2000
DateDiff seems not working SELECT DATEDIFF(Minute,Members.Deb, Members.Fin) As Diff From Members I want to get the number of minutes for each members between to columns Members.Deb and Members.Fin.. and it doesn't work thank youangiras I found the seconds in that way SELECT DATEDIFF("s",Members.Deb, Members.Fin) As Diff From Members but if I use "m" or "minute" I get an error, how can I get the minutes ? thank youangiras...

Web resources about - SQL > My SQL - asp.net.mysql

Resources last updated: 12/18/2015 2:09:18 PM