Quantcast
Channel: MySQL Forums - Connector/NET and C#, Mono, .Net
Viewing all 1447 articles
Browse latest View live

MySqlConnection.GetSchema for Columns (no replies)

$
0
0
To get column information with SqlClient or other providers you do:
DataTable schema = conn.GetSchema("Columns", new string[4] { conn.Database, null, "products", null });

With MySQL Connector/NET is different:
DataTable schema = conn.GetSchema("Columns", new string[4] { null, conn.Database, "products", null });

Note that the first 2 items in the array are swapped.

The difference is that MySQL Connector/NET puts the database name in the TABLE_SCHEMA column, while other providers put it in the TABLE_CATALOG column and use TABLE_SCHEMA for other information (in SQL Server TABLE_SCHEMA is typically dbo).

Is this behavior by design or a bug ?

Problem with Visual Studio 2010 Lightswitch Beta and MySQL 6.3.5 Connector NET (no replies)

$
0
0
I have installed VS2010 Lightswitch Beta and the MySQL 6.3.5 Connector Net. When I try to connect to an

external data source in Lightswitch I get a message that "The MySQL Connector Net 6.3.5 package did not load

correctly" and then I can't browse any data providers. I ran VS2010 with the "/log" option and get the

following in the log file:

349 Begin package load [MySQL Connector Net 6.3.5] {79A115C9-B133-4891-9E7B-242509DAD272} VisualStudio

2010/10/17 00:17:19.291
350 ERROR SetSite failed for package [MySQL Connector Net 6.3.5] {79A115C9-B133-4891-9E7B-242509DAD272}

80004003 - E_POINTER VisualStudio 2010/10/17 00:17:19.306
351 ERROR End package load [MySQL Connector Net 6.3.5] {79A115C9-B133-4891-9E7B-242509DAD272} 80004003 -

E_POINTER VisualStudio 2010/10/17 00:17:19.363

377 Begin package load [MySQL Connector Net 6.3.5] {79A115C9-B133-4891-9E7B-242509DAD272} VisualStudio

2010/10/17 00:25:24.738
378 ERROR CreateInstance failed for package [MySQL Connector Net 6.3.5] {79A115C9-B133-4891-9E7B-242509DAD272}

80131604 VisualStudio 2010/10/17 00:25:24.756
379 ERROR End package load [MySQL Connector Net 6.3.5] {79A115C9-B133-4891-9E7B-242509DAD272} 80004005 -

E_FAIL VisualStudio 2010/10/17 00:25:24.757

I have tried reinstall, repair, etc. - no joy. This is Windows 7 Ultimate x64.

Any help greatly appreciated.

Thx

Jim

Type mapping (1 reply)

Non-English Character Update problem (no replies)

$
0
0
Hi...

I am trying to update a field with non-english characters, in debug mode i check querry and it's fine when I try to run it on phpmyadmin but it doesn't work here... it doesn't throw an exception but it doesn't update the field either

here is my code... what should I do to solve this ?

public static void updateCastDetail(int castId, movieCast mvCast)
{
using (MySqlConnection connection = ConnectionManager.GetDatabaseConnection())
{
MySqlCommand command = connection.CreateCommand();

string mySqlBday = mvCast.bday.Year + "-" + mvCast.bday.Month + "-" + mvCast.bday.Day;

command.CommandText = "UPDATE mv_cast set name = '" + mvCast.name.Replace("'", "''") + "', location = '" + mvCast.location.Replace("'", "''") + "', bday = '" + mySqlBday + "' where id = '" + castId + "'";

command.ExecuteNonQuery();


}


}

DateTime error (no replies)

$
0
0
Hi,
I have a stored procedure taking in a datetime parameter as follows:

CREATE DEFINER=`root`@`localhost` PROCEDURE `p5`(inizio DATETIME)
BEGIN
SELECT * FROM allottment WHERE dal > inizio;
END

My C# code is as follows:

MySqlCommand oCmd = new MySqlCommand("p5", sqlConn);
oCmd.Parameters.Add("inizio", MySqlDbType.Datetime).Value = "2007-03-25";// new DateTime(2008, 4, 12, 18, 17, 15); DateTime.Now;
MySqlDataAdapter adapter = new MySqlDataAdapter(oCmd);
adapter.Fill(ds);

But when run the following exception occurs:

#42000You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'p5' at line 1

I have tried the parameter value as a DateTime as well as a string. No luck.
I am using MySQl 5.1 with Workbench 5.2.28CE.

Please help.

Add Connection window disappear (no replies)

$
0
0
There are couple topics about disappearing windows during ading connection in Visual Studio (in my case VS 2008 SP1).

Partial solution is to install specific version of MySQL connector. When somebody discover that moderator closed the topic.

BUT IT'S NOT A SOLUTION, PROBLEM ISN'T SOLVED! WHY ARE YOU CLOSING THOSE TOPICS!

In this case:
http://forums.mysql.com/read.php?38,355055,358232
problem was PARTIALLY solved by instaling 6.2 version instead of 5.1.35.

But for Christ sake why after 7 MONTHS when I'm installing 6.3.5 version this problem still exist?

Dear MySQL developers, please, I beg You - check Your work and release updated version of MySQL connector and answer for our problems, not closing topics.

Backing Up and restoring in c# with progress bar (no replies)

$
0
0
Is there a way to backup and restore MySQL databases in c# using connector .net and also be able to track progress with a progress bar? i don't necessarily need full code, i just need to know what classes are used to backup and restore and if progress tracking is possible.

load balancing and failover with MySQL Cluster using Connector/NET (no replies)


dot net connector + vb.net + picture + blob (no replies)

$
0
0
Good Day

Hope anyone could help me i have a program that should display worker photo's, but could not manage to get it working in mysql (it is working in firebird, but i prefer mysql).

My Vb.net code :

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
With OFDialog1
.InitialDirectory = "C:\"
.Filter = "All Files|*.*|Bitmaps|*.bmp|GIFs|*.gif|JPEGs|*.jpg"
.FilterIndex = 2
End With

If OFDialog1.ShowDialog() = DialogResult.OK Then
With PictureBox1
.Image = Image.FromFile(Me.OFDialog1.FileName)
.SizeMode = PictureBoxSizeMode.StretchImage
End With
End If


Dim ms As New MemoryStream
Me.PictureBox1.Image.Save(ms, Me.PictureBox1.Image.RawFormat)

Dim arrayImage() As Byte = ms.GetBuffer
ms.Close() ' Closes the Memory Stream
MsgBox(arrayImage.Length)

SqlCmd1.CommandText = "INSERT INTO mytable (PHOTO) VALUES (?)"
SqlCmd1.Parameters.Add("?Param1", SqlDbType.Image, arrayImage.Length).Value = arrayImage


DB1.Open()
SqlCmd1.ExecuteNonQuery()
DB1.Close()

End Sub

It gives me the following error if executed :
"Fatal error encountered during command execution."


Thank you in advance

Albertus Geyser

MySQL Connector/Net 6.3.5 maintenance released (no replies)

$
0
0
Dear MySQL Users,

We're happy to announce the latest maintenance release of MySQL Connector/Net 6.3.5.

Version 6.3.5 maintenance release includes:
Fixes to some installer bugs related to .NET Framework 4.0
Fixes for several other bugs

For details see http://dev.mysql.com/doc/refman/5.1/en/connector-net-news-6-3-5.html

MySQL Connector 6.3.5 :

1. Provides secure, high-performance data connectivity with MySQL.
2. Implements ADO.NET interfaces that integrate into ADO.NET aware tools.
3. Is a fully managed ADO.NET driver written in 100% pure C#.
4. Provide Visual Studio Integration


If you are a current user, we look forward to your feedback on all the new capabilities we are delivering.
As always, you will find binaries and source on our download pages.

Please get your copy from our Download
http://dev.mysql.com/downloads/connector/net/6.3.html]

To get started quickly, please take a look at our short tutorials.
MySQL Connector/NET Tutorials
http://dev.mysql.com/doc/refman/5.1/en/connector-net-tutorials.html

Blog postings and general information can be found on our Developer Zone site.
MySQL Developer Zone
http://dev.mysql.com/usingmysql/dotnet/
.NET Forum
http://forums.mysql.com/list.php?38
Blog
http://planet.mysql.com

Connector/NET Documentation and details on changes between releases can be found on these
pages

http://dev.mysql.com/doc/refman/5.1/en/changes-6.3.x.html

http://dev.mysql.com/doc/refman/5.1/en/connector-net.html

http://dev.mysql.com/doc/refman/5.1/en/connector-net-news-6-3-5.html


If you need any additional info or help please get in touch with us.
Post in our forums or leave comments on our blog pages.

- The MySQL Connector/NET Team

Connector .Net 6.3.5 Access denied for user ''@'localhost' (using password: NO) (no replies)

$
0
0
I followed the tutorial here: http://dev.mysql.com/doc/refman/5.1/en/connector-net-tutorials-asp-roles.html#c11548 when setting up my connection. I created two users and roles but when I click the test links in the provider section I get an error that says they could not connect to the database.

If I try to use the actual login form the error message I get says:

An exception occurred communicating with the data source.

Action: GetUsers

Exception: MySql.Data.MySqlClient.MySqlException: Access denied for user ''@'localhost' (using password: NO)
at MySql.Data.MySqlClient.MySqlStream.ReadPacket()
at MySql.Data.MySqlClient.NativeDriver.AuthenticateNew()
at MySql.Data.MySqlClient.NativeDriver.Authenticate()
at MySql.Data.MySqlClient.NativeDriver.Open()
at MySql.Data.MySqlClient.Driver.Open()
at MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings)
at MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection()
at MySql.Data.MySqlClient.MySqlPool.GetPooledConnection()
at MySql.Data.MySqlClient.MySqlPool.TryToGetDriver()
at MySql.Data.MySqlClient.MySqlPool.GetConnection()
at MySql.Data.MySqlClient.MySqlConnection.Open()
at MySql.Web.Security.MySQLMembershipProvider.GetUsers(String username, String email, Int32 pageIndex, Int32 pageSize, Int32& totalRecords)

My Connections string section matches the tutorial spot on and my membership and role providers look like this:

<membership defaultProvider="MySqlMembershipProvider">
<providers>
<clear/>
<remove name="MySqlMembershipProvider" />
<add name="MySqlMembershipProvider"
type="MySql.Web.Security.MySQLMembershipProvider, MySql.Web"
connectionStringName="LocalMySqlServer"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="false"
requiresUniqueEmail="true"
passwordFormat="Hashed"
maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="8"
minRequiredNonalphanumericCharacters="1"
passwordAttemptWindow="10"
applicationName="/"
autogenerateschema="true" />
</providers>
</membership>

<roleManager enabled="true" defaultProvider="MySqlRoleProvider">
<providers>
<clear />
<remove name="MySqlRoleProvider" />
<add connectionStringName="LocalMySqlServer"
applicationName="/"
name="MySqlRoleProvider"
type="MySql.Web.Security.MySQLRoleProvider, MySql.Web"
autogenerateschema="true"/>
</providers>
</roleManager>

Any idea what could be causing the error?

Error Loading Assembly in Web.Config (no replies)

$
0
0
Hello,

I got the below error after deploying my asp.net site, please how can i solve it:

Server Error in '/' Application.
Configuration Error Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Description: An error occurred During the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. Please review the specific error details below and modify your configuration file Appropriately.
Parser Error Message: Could not load file or assembly 'MySql.Data, Version=5.2.7.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. Parser Error Message: Could not load file or assembly 'MySql.Data, Version = 5.2.7.0, Culture = neutral, PublicKeyToken = c5687fc88969c44d' or one of ITS dependencies. The system cannot find the file specified. The system can not find the file specified.

Source Error: Source Error:

Line 44: <add assembly="MySql.Data, Version=6.2.2.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/></assemblies> Line 44:


Source File: e:\home\chsoft\Web\universoterapeutico\web.config Line: 44 Source File: e: \ home \ chsoft \ Web \ universoterapeutico \ web.config Line: 44
Assembly Load Trace: The following information can be helpful to determine why the assembly 'MySql.Data, Version=5.2.7.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' could not be loaded. Assembly Load Trace: The following information helpful to Can Be determine why the assembly 'MySql.Data, Version = 5.2.7.0, Culture = neutral, PublicKeyToken = c5687fc88969c44d' could not be loaded.
WRN: Assembly binding logging is turned OFF. WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. To enable assembly bind failure logging, set the registry value [HKLM \ Software \ Microsoft \ Fusion! EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging. Note: There is some performance penalty Associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog]. To turn this feature off, remove the registry value [HKLM \ Software \ Microsoft \ Fusion! EnableLog].

Version Information: Microsoft .NET Framework Version:2.0.50727.4200; ASP.NET Version:2.0.50727.4016 Version Information: Microsoft. NET Framework Version: 2.0.50727.4200; ASP.NET Version: 2.0.50727.4016

Any prompt solution will be appreciated.

how to connect remotely C# and Mysql ( HTTP tunneling ) using MySql Connector (no replies)

$
0
0
The following code is used to connect C# with mysql server
Collapse

connectionParam = "SERVER=" + DbServer + ";DATABASE=" + dbName + ";UID=" + uName+ ";PASSWORD=" + pass;

MySqlConnection mConnection = new MySqlConnection(connectionParam );

But what will be the code, if MySql can only be accessed through HTTP Tunneling.

Tunneling URL: http://www.xyzpqr.com/SQLyogTunnel.php (for example)

Errors using Dataset Designer in Visual Studio 2008 (no replies)

$
0
0
Hi,

I am searching for a solution to following error:

"Mouse drag operation failed."
"Could not retrieve schema information for table or view 'payment'.."

'payment' is a table I wanted to drag from server explorer to my Typed Dataset. I use .NET Connector in version 6.3.4.0, and MySql server is located over the WAN (version 5.0.90-log).

Is actually creating typed dataset by drag and drop supported? I am not able to find info on that any where in the docs.

Thank You for any help

Timeout during Commit (no replies)

$
0
0
We're having mysterious network problems with MySQL. Simple update query (updating single row using index) usually runs immediately, then sometimes (let's say 1 in 1000 times) fails with timeout. Same with simple insert query. Database is not overloaded.
We suspect network problems and are looking for solution, so if anyone has had this kind of problems I'd definitely like to head about it.
---
Now to the main point. To make matters worse, insert query is failing in during transaction commit (we have few similar queries, but this happens even in the simplest one - just single insert into single table, no locks, nothing). When it happens, transaction.Commit throws Exception. We catch it and assume transaction was rolled back and retry inserting data again.

The result is two rows with same data in table. What assumptions are possible if Commit fails? Was row inserted or not? Is this behaviour but in MySql Connector/Net or is it by design. Any advice (beside manually checking if data is in table or not)?

Thanks in advance.
Branko

Cascading auto-increment keys and C# DataSets - MS SQL vs MySQL (no replies)

$
0
0
Hi

Does anybody know why the cascading foreign key relationships to auto-incrementing primary keys in a .net DataSet behaves differently with MySQL vs. MS SQL?

I'll flesh it out a bit. I created a parent table with an AI PK, and a child table with an AI PK and a foreign key field to the parent PK. Then I created a cascading relationship between the two, and a single typed DataSet with the same foreign key relationship. The DataSet's auto-increment is set to -1 (the default) to allow to SQL engine to supply the correct incremental values on update. The adapter is configured to 'Refresh the data table' after inserts. On MSSQL, I created 1 parent row and 2 child rows, added them and updated the database and the primary keys change to the next incremental values from the db, and the foreign key relationship holds.

Now with MySQL, I selected the Refresh data table option, but after update the new PK values aren't retrieved, and stay at -1. The parent row is committed to the db, but the child row can't because it doesn't know what the new parent PK is. Strangely enough, when I go back to the dataset wizard the refresh option is unchecked.

Is this expected behavior and does anybody know a workaround? Tried with v5.2.7 and 6.3.5, VS2008 on Win7.

Thanks, Dave

Installing connector 6.3.5 on Windows 7 64 bit (no replies)

$
0
0
I have looked all over the internet, and cannot find an answer. Sorry if it is simple.

I have downloaded the latest 6.3.5 MSI file. When I attempt to install it, it progresses about halfway through, then begins a rollback and fails to install. Is there any way to find what failed, or is there a known problem that I can work around?

My environment is Windows 7, 64 bit; Visual Studio 2008. I downloaded the MSI version from the MySQL web site.

Thanks,

Don

Visual Studio 2010 (2 replies)

$
0
0
I apologise if this topic has been covered before. I have attempted to search the net for possible solutions but have been unsuccessful.

I am an ex-developer that has decided to venture back into development, so please be gentle with me...

I am embarking on developing a commercial web application using Visual Studio 2010 and MySQL (given that MySQL is installed on the servers hosting my website). I am running Windows XP Home Edition SP3.

I have installed the mysqlconnector (net-6.3.5) and followed the instructions to connect via the Visual Studio Server Explorer. I have captured the correct IP Address, username & password but on trying to connect I get the error 'Unable to connect to any of the specified MySQL Hosts". I did check that the my Firewall permits access, and also tried this with the firewall turned off, without success.

As mentioned the MySQL database resides on my web server (which is a shared server administered by my hosting organisation). I have not installed any MySQL components on my desktop at this stage.

I am itching to get started with this project but am feeling quite demotivated by this probably simple to solve problem and appreciate any help.

Gill in South Africa.

Connecting to MySQL on windows server (no replies)

$
0
0
Hi All

I haven't been here for ages

I've been using a connector i download from here a long time ago

MySql.Data.dll

But recently, .net problems , which I believe are unrelated , convinced me to come back here to update the tech.

Now, I see there is 6.35 but no dll to download

Have things changed a lot,

Do i have to compile the dll myself

I ran mysql.data.msi on my system, Windows 7 home, with MySQL installed, but no IIS 7, probably the latest version of .net, the stopped prematurely, I remember having a similar problem installing admin tools and finding a solution here, and and don't remember what it was.

Question:

In a hosted environment, how do you connect to MySQL from ASP.net 2.0/3.5

Cheers

No luck with InsertRow - ExecuteNonQuery slow (no replies)

$
0
0
The scenario is this - a local SQL Server database with data from 7 different tables needs to synchronize data to a mysql database over the web (a secured customer portal accesses the data on the mysql site).

I'm using .Net connector for the mysql connection. Is it best to use a mysqlcommand, generate my sql insert, and the executenonquery for each row in my source tables? FYI... I have this working but it's extremely slow, almost 2 hours to process all 7 tables.

I tried:


For Each dr As DataRow In sourceTable.Rows
destinationTable.ImportRow(dr)
Next

But no luck. Just wondering if there's a better way? Any suggestions appreciated! Criticism too!

FYI... I originally used MySQL ODBC connector & a Microsoft Access database with linked tables to both the SQL server & MySQL server. This was a very simple, straightforward setup with Delete, Update, & Insert queries however, this was locking up the system after running for well over the 2 hrs the mysqlcommand is running now.
Viewing all 1447 articles
Browse latest View live


Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>