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

Stored procedure paramter passing (1 reply)

$
0
0
I have been readind both MSDN and the Connector's docs and the only examples I find are using cmd.Parameters.AddWithValue.

What I really need to do, though, is setting the UpdateCommand of an DataAdapter to be the the stored procedure.

What I am doing (in C#) is the following (split is a custom object that has a DataAdapter member exposed via the DataAdapter property).

-------------
var updateCmd = new MySqlCommand("updateBrokerSymbols");
var param = new MySqlParameter("@ghrSym", MySqlDbType.VarChar, 9, "ghr_symbol");
param.Direction = ParameterDirection.Input;
updateCmd.Parameters.Add( param.Clone() );

param = new MySqlParameter("@broker", MySqlDbType.VarChar, 10, "broker");
param.Direction = ParameterDirection.Input;
updateCmd.Parameters.Add( param.Clone() );

param = new MySqlParameter("@brokerSym", MySqlDbType.VarChar, 9, "broker_symbol");
param.Direction = ParameterDirection.Input;
updateCmd.Parameters.Add( param.Clone() );

split.DataAdapter.UpdateCommand = updateCmd.Clone();
-------------

When I modify the data in the DataGridView and then launch the update, tgough, I get the following Exception:
"Incorrect number of arguments for PROCEDURE ghr.updateBrokerSymbols; expected 3, got 0"

Any ideas? Help would be greatly appreciated.

Database Connections Not Dropping with Pooling=false (no replies)

$
0
0
Hi,

Eventhough I have turned off pooling within the connection string, connections are still remaining active after disposing.

Here is the connection string string which we store in the web.config file.

<connectionStrings>
<add name="GBTF" connectionString="server=www.****.co.uk;user id=******; password=******; database=******; pooling=false; max pool size=100; port=3306;Convert Zero Datetime=True;" />
</connectionStrings>

This is an ASP/VB.Net project.

Any advice appriciated.

Thanks
Darren

Plans for porting connector to .Net Core / .Net Standard? (no replies)

$
0
0
Hi,

I would just like to know if the MySQL Connector team has made any plans (or even better, has a timeline) for porting the .NET connector to .NET Core ( http://dotnet.github.io/ ) now that Microsoft has released RC2 and has published a timeline for RTM?

This is going to be very important for anybody trying to run .Net Core applications on other platforms than Windows (Linux, mobile, etc). The MySQL .Net connector is currently dependent on .Net Framework 4.5 and would need to be ported to the .Net Standard platform for compatibility (more information here https://github.com/dotnet/corefx/blob/master/Documentation/architecture/net-platform-standard.md).

Any information appreciated.

Thanks,

Question on Connection string (no replies)

$
0
0
Hi,

As per the documentation https://dev.mysql.com/doc/connector-net/en/connector-net-connection-options.html ,

"The name or network address of the instance of MySQL to which to connect. Multiple hosts can be specified separated by commas."

My connection string with 1 host works well.
But when I add an another host separated by comma, I get the following error.
"Unable to connect to any of the specified MySQL hosts."

Basically I am able to connect to these hosts individually, but when I add them as comma separated it doesn't work.

Please let me know the right way to connect to the replicated servers so that if one goes down the application can always go to the next available one.

Requesting your response asap as we have a blocker on this.

Thanks,
Prem

Error in C# app SSPI failed on Windows 10 computers (3 replies)

$
0
0
We have started getting an System.Security.Authentication.AuthenticationException with the message "A call to SSPI failed". The inner exception message is "The Local Security Authority cannot be contacted".

We use the .NET Connector in a C# application. The error happens on the line to Open() the MySqlConnection. We use a self-signed certificate. It may be caused/related to a recent Windows 10 update since it seems to only affect them. Also our apps that use C++ (non .NET) do not have the issue even on the same computer.

Let me know what information may help or if you have any questions. Thanks!

Connection attributes lenths in HandshakeResponse packet are specified as num of characters, rather than as number of bytes (no replies)

$
0
0
Connection attribute key and value lenths in HandshakeResponse packet are specified as num of characters, rather than as number of bytes:

see:

MySql.Data.MySqlClient.NativeDriver.SetConnectAttrs()

lines:

string value = (string)property.GetValue(attrs, null);
connectAttrs += string.Format("{0}{1}", (char)name.Length, name);
connectAttrs += string.Format("{0}{1}", (char)value.Length, value);

.NET string.Length property returns number of characters, but here it is necessary to specify the lengths in bytes.

vs2015 mysql issue (no replies)

$
0
0
I have installed the latest stable connector/net 6.9.8 for windows on my PC, when i am trying to use EF connecting to mysql, it doesnot have mysqlDB option, only mssql. i also tried it in vs2013 and i can chose both mysql and mssql to connect to my DB, any one got the answer for me ? thanks.

Error uninstalling connector (no replies)

$
0
0
So im trying to uninstall connector but it fails, im gonna paste here the log

Beginning removal of Connector/NET 6.9.9.
1: Action 02:09:46: INSTALL.
1: 1: MySQL Connector Net 6.9.9 2: {E09F82E9-3EB3-4725-BDC8-3C77F83E262C}
1: Action 02:09:46: FindRelatedProducts. Searching for related applications
1: Action 02:09:46: AppSearch. Searching for installed applications
1: Action 02:09:46: LaunchConditions. Evaluating launch conditions
1: Action 02:09:46: ValidateProductID.
1: Action 02:09:46: CostInitialize. Computing space requirements
1: Action 02:09:46: FileCost. Computing space requirements
1: Action 02:09:46: CostFinalize. Computing space requirements
1: Action 02:09:46: InstallValidate. Validating install
1: Action 02:09:46: Setv4InstallUtil.
1: Action 02:09:46: InstallInitialize.
1: Action 02:09:46: GenerateScript. Generating script operations for action:
1: InstallInitialize
1: Action 02:09:46: RemoveExistingProducts. Removing applications
1: Action 02:09:46: ProcessComponents. Updating component registration
1:
1: Action 02:09:46: MsiUnpublishAssemblies. Unpublishing assembly information
1: Application Context:Unpublishing assembly information, Assembly Name:
1: Action 02:09:46: UnpublishFeatures. Unpublishing Product Features
1: Feature: Unpublishing Product Features
1: Action 02:09:46: UninstallPerfCounterData.
1: Action 02:09:46: RollbackUnregisterPerfCounterData.
1:
1: Action 02:09:46: UnregisterPerfCounterData.
1:
1: Action 02:09:46: RemoveRegistryValues. Removing system registry values
1: Key: Removing system registry values, Name:
1: Action 02:09:47: RemoveShortcuts. Removing shortcuts
1: Shortcut: Removing shortcuts
1: Action 02:09:47: ManagedDataUnInstallSetup.
1: Action 02:09:47: ManagedDataUnInstall. Unregistering data provider from machine.config
1: Action 02:09:47: ManagedWebUnInstallSetup.
1: Action 02:09:47: ManagedWebUnInstall. Unregistering web providers from machine.config
1: Action 02:09:47: RemoveFiles. Removing files
1: File: Removing files, Directory:
1: Action 02:09:47: RemoveFolders. Removing folders
1: Folder: Removing folders
1: Action 02:09:47: CreateFolders. Creating folders
1: Action 02:09:47: InstallFiles. Copying new files
1: Action 02:09:47: CreateShortcuts. Creating shortcuts
1: Action 02:09:47: WriteRegistryValues. Writing system registry values
1: Action 02:09:47: InstallPerfCounterData.
1: Action 02:09:47: RegisterUser. Registering user
1: Action 02:09:47: RegisterProduct. Registering product
1: Action 02:09:47: MsiPublishAssemblies. Publishing assembly information
1: Action 02:09:47: PublishFeatures. Publishing Product Features
1: Action 02:09:47: PublishProduct. Publishing product information
1:
1: Action 02:09:47: InstallFinalize.
1: Action 02:09:47: InstallInitialize.
1: Action 02:09:47: ProcessComponents. Updating component registration
1: Action 02:09:47: MsiUnpublishAssemblies. Unpublishing assembly information
1: Application Context:Global, Assembly Name:MySql.Web,version="6.9.9.0",culture="neutral",publicKeyToken="C5687FC88969C44D",processorArchitecture="MSIL"
1: Application Context:Global, Assembly Name:MySql.Data.Entity,version="6.9.9.0",culture="neutral",publicKeyToken="C5687FC88969C44D",processorArchitecture="MSIL"
1: Application Context:Global, Assembly Name:MySql.Data,version="6.9.9.0",culture="neutral",publicKeyToken="C5687FC88969C44D",processorArchitecture="MSIL"
1: Action 02:09:47: UnpublishFeatures. Unpublishing Product Features
1: Feature: EntityFramework
1: Feature: Samples
1: Feature: DocsFeature
1: Feature: Core.Feature
1: Feature: WebProviders
1: Feature: CSSamples
1: Feature: VBSamples
1: Feature: Plugins.Fabric
1: Feature: Plugins
1: Action 02:09:47: RollbackUnregisterPerfCounterData.
1: Action 02:09:47: UnregisterPerfCounterData.
1: Action 02:09:47: RemoveRegistryValues. Removing system registry values
1: Key: \Software\MySQL AB, Name: Default
1: Key: \Software\MySQL AB\MySQL Connector/Net, Name: Version
1: Key: \Software\MySQL AB\MySQL Connector/Net, Name: Location
1: Key: \Software\MySQL AB\MySQL Connector/Net, Name:
1: Key: \SOFTWARE\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\MySQL Connector Net 6.9.9 v4.0, Name:
1: Key: \SOFTWARE\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\MySQL Connector Net 6.9.9 v4.0, Name:
1: Key: \SOFTWARE\Microsoft\.NETFramework\v4.5.50709\AssemblyFoldersEx\MySQL Connector Net 6.9.9 v4.5, Name:
1: Key: \SOFTWARE\Microsoft\.NETFramework\v4.5.50709\AssemblyFoldersEx\MySQL Connector Net 6.9.9 v4.5, Name:
1: Key: \SYSTEM\CurrentControlSet\Services\.NET Data Provider for MySQL\Linkage, Name: Export
1: Key: \SYSTEM\CurrentControlSet\Services\.NET Data Provider for MySQL\Performance, Name:
1: Key: \SYSTEM\CurrentControlSet\Services\.NET Data Provider for MySQL\Performance, Name: Library
1: Key: \SYSTEM\CurrentControlSet\Services\.NET Data Provider for MySQL\Performance, Name: Open
1: Key: \SYSTEM\CurrentControlSet\Services\.NET Data Provider for MySQL\Performance, Name: Collect
1: Key: \SYSTEM\CurrentControlSet\Services\.NET Data Provider for MySQL\Performance, Name: Close
1: Key: \SYSTEM\CurrentControlSet\Services\.NET Data Provider for MySQL\Performance, Name: IsMultiInstance
1: Key: \SYSTEM\CurrentControlSet\Services\.NET Data Provider for MySQL\Performance, Name: Counter Names
1: Key: \SYSTEM\CurrentControlSet\Services\.NET Data Provider for MySQL\Performance, Name: Counter Types
1: Action 02:09:48: RemoveShortcuts. Removing shortcuts
1: Shortcut: upfn1-0t|Documentation
1: Shortcut: vaitcdd6|ChangeLog
1: Shortcut: _rq6aex9|Release Notes
1: Action 02:09:48: ManagedDataUnInstall. Unregistering data provider from machine.config
1: Action 02:09:48: Rollback. Rolling back action:
1: Unregistering data provider from machine.config
1: Removing shortcuts
1: Removing system registry values
1: UnregisterPerfCounterData
1: RollbackUnregisterPerfCounterData
1: Unpublishing Product Features
1: Unpublishing assembly information
1: Updating component registration
1: InstallInitialize
1: 1: MySQL Connector Net 6.9.9 2: {E09F82E9-3EB3-4725-BDC8-3C77F83E262C} 3: 3
1: The action 'Remove' for product 'Connector/NET 6.9.9' failed.

Bugfix for 'Tabs in whitespace' fatal errors? (no replies)

$
0
0
Almost a year ago a bug was reported (and verified) that makes the Connector choke on tabs used in whitespace of any parametrised query:

http://bugs.mysql.com/bug.php?id=78760

Any version beyond 6.9.5 is therefore unusable; still no fix in 6.9.9 (or 7 so far).

Could anyone from MySql comment on whether/when a fix for this bug is scheduled?

Support for Geometry Types in MySqlGeometry (no replies)

$
0
0
What's the status on support for anything other than POINT with MySqlGeometry. The following contructor woks on byte[]'s that are returned from queries

MySqlGeometry(MySqlDbType type, byte[] val)

as long as the values are POINT's. When it's anything other than a POINT (MULTIPOINT, LINESTRING etc) then it returns gibberish. This works in competing providers such as PostgreSQL and SqlServer. Is there something that needs to be done to the byte[] or is this just missing.

Rough ETA for EF Core 1.0 support? (1 reply)

$
0
0
Can anyone give even a rough ETA for EF Core support? Knowing whether we can expect this month, this quarter, next quarter, or even just next year would be really helpful for planning purposes for many people I'm sure.

There are a few posts about it already, but thought I'd open another top-level post to call attention to this issue.

How to parse the sql::ResultSet to get the json::object? (no replies)

$
0
0
I have modified a sample program in Connector/C++ 1.1.7 to put a JSON_OBJECT into a table called 'test' with one column called 'id' which is of JSON type. When I query the 'test' table and get the sql::ResultSet object, I'm unable to convert the string into a json::object, though it shows up as a properly formed json string - e.g. {"name": "Ram"}. By the way, I'm using Ubuntu 14.04 LTS machine.

SELECT Query is slow when run remotely in MySQL (no replies)

$
0
0
Hi,

When I connect MySQL from remote server and run below SQL query then the results are very slow(Sometime even faced lost connection Issue).

However when I run the same SQL query on the local machine (Machine where MySQL is Installed) then results are very fast.

SELECT * FROM CUSTOMERS

The customer tale contains two million records.

I have also enable skip-host-cache and skip-name-resolve in MySQL configuration.

Both machine is connected using the LAN IP and customer table is InnoDB table. I am using MySQL 5.6.

Can you please suggest me on this, why SQL query are very slow when run It from remote machine.

Thank you,
Sujeet

Packets larger than max_allowed_packet are not allowed (no replies)

$
0
0
Good morning,

We are having several problems with this error:

Packets larger than max_allowed_packet are not allowed

Each time we see this error in our websites we have to restart de MySql Service.

Our software is developed in .Net 3.5 with the last mysql connector.
We have increased the max_allowed_packet=1G in the my.ini [mysqld] and checked if it really has this value with the show variables like 'max_allowed_packet'; query. It's still happening.

We don't have blobs, images and anything on our database big enoguh to to reach this value. The biggest value in our database is just 210K and we don't do almost inner join queries.

What should we do? We've tried everything... even adding the the max_allowed_packet=100M to the [mysql] section.

Why is this still happening?

Many thanks

Datatable empty after update and refill after MySQL 5.1 (no replies)

$
0
0
I have a problem re-selecting with a DataTable after adding a new row. The ms_perhist table is not empty, but after the button1_Click event the DataGridView1 shows columns from ms_perhist, but with 0 rows.The I tested with 2 versions of MySQL and MySQL 5.0 displays the table correctly. What should I do to make the data appear in later versions of MySQL?

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using MySql.Data.MySqlClient;


namespace MySQL_Test
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

public MySqlConnection connection;
public DataTable table1;
public MySqlDataAdapter adapter1;
public MySqlCommandBuilder cmb1;

public void opentable(String sql)
{
adapter1 = new MySqlDataAdapter(sql, connection);
cmb1 = new MySqlCommandBuilder(adapter1);
table1 = new DataTable();
adapter1.Fill(table1);
}

private void Form1_Load(object sender, EventArgs e)
{
connection = new MySqlConnection("User ID=XXX;Password=XXX;Connection Timeout=28800;Character Set=utf8;Data Source=XXX;Database=XXX;Port=3306;Compress=True");
dataGridView1.DataMember = "ms_per";
}

private void button1_Click(object sender, EventArgs e)
{
connection.Open();
opentable("SELECT * FROM ms_per WHERE PerCode='001'");
if(table1.Rows.Count==0)
{
DataRow newrow = table1.NewRow();
newrow["PerCode"] = "001";
table1.Rows.Add(newrow);
}
adapter1.Update(table1);
opentable("SELECT * FROM ms_perhist");
dataGridView1.DataSource = table1;
connection.Close();
}
}
}

MySQL Export Excel File Using C# (no replies)

$
0
0
Hi everyone!
I came here for some help. :)
I am working on a proyect for my mom, I wanna help her with her secretary function in a school. So I am trying to make a program for making her taks more easy.
This program needs to EXPORT an excel file from a database, but i dont know how to do that.

Using Visual Studio
Languaje : C#
Database server: MySQL

I try with Excel library but it seems is not working for >Office2007, so maybe you did that one day before so u could help me with that :).

That's all. Its gonna be so great If U know how.
Have a nice day to everyone.

MySQL Connector/Net does not currently support distributed transactions. (no replies)

$
0
0
Hi,

Im trying to achieve distributed transactions using .Net with Mysql. Getting MySQL Connector/Net does not currently support distributed transactions.

Can anyone let me know if we can use any other connector for Mysql which supports distributed transactions.

Thanks
Vinod M

Authentication error - Reading from the stream has failed (no replies)

$
0
0
Hi all, first post. I need help with a very frustrating problem that we're having and not sure where else to look at to find the root cause of the error.

I have the following setup;
* .NET 4.5.1 app
* MySQL Connector for .NET 6.9.9
* MySQL Entity Framework 6.9.9
* MySQL Enterprise Edition 5.7.13
* Windows Server 2012

We have the following machines:
- 2 dev machines
- App Server and DB Server (hardened)
- 1 Win7 machine



Problem:
We built a .NET app and get error in Test Server 2 'Authentication to host '<host>' for user '<user>' using method 'mysql_native_password' failed with message: Reading from the stream has failed.

MySQL error log states 'Access denied for user 'user@host' (using password: YES)

This happens whenever a 'Select' query is performed, but oddly it's able to insert into one of the DB tables.

- Issue happens only when we run the app from the app server or DB server
- Issue doesn't happen when the app is ran from the Win7 workstation using same DB account to DB server
- DB user account has full privilege over the schema, no problem running SQL statements in Workbench
- port 3306 is enabled in the firewall
- some testing had been done in a TEST server which is not as hardened and that was working fine as well


What has been attempted so far:
* Set the server in connection string to IP addr, server name, and 127.0.0.1 (when app is ran directly from the DB server)
* created test apps to validate connectivity/SQL execution using simple ADO.NET (no EF6)
* restarted the server


Thanks in advanse

using the SqlParameterCollection (no replies)

$
0
0
Hi,

I got this:

[----- To overcome this, you need to iterate through the source array and add each value to the SqlParameterCollection collection----]

string[] source = Convert.ToString(cboToCountry.EditValue).Split(new char[] { cboToCountry.Properties.SeparatorChar });

StringBuilder sb = new StringBuilder();

foreach (string s in source)

sql_command.Parameters.AddWithValue("param_country", s.Trim());

not sure how can I use the MySqlParameterCollection and MySQL Connectors.

here is my code:

sql_connection = new MySqlConnection(serverClass.connectionstring("BlueFile", "BlueFile", "Server"));
sql_connection.Open();

sql_command = new MySqlCommand("sp_populate_memo_country_companies", sql_connection);
sql_command.CommandType = CommandType.StoredProcedure;
// sql_command.Parameters.AddWithValue("param_country", country_codes(Convert.ToString(cboToCountry.EditValue))).MySqlDbType = MySqlDbType.VarChar;

string[] source = Convert.ToString(cboToCountry.EditValue).Split(new char[] { cboToCountry.Properties.SeparatorChar });
StringBuilder sb = new StringBuilder();
foreach (string s in source)
{
sql_command.Parameters.AddWithValue("param_country", s.Trim()).MySqlDbType = MySqlDbType.VarChar;
}

[A]MySQL.Data.MySqlClient.MySqlConnection cannot be cast to [B]MySQL.Data.MySqlClient.MySqlConnection. (no replies)

$
0
0
I hope I am posting this in the right place - please forgive me if I am not...

I have a WinForms / .Net 4.0 application in Visual Studio 2015 Update 3.
When I try to add, or edit, a TableAdapter in any of my DataSets, I get this error:

==============================================================================
The wizard detected the following problems when configuring the TableAdapter:

Details:

Generated SELECT statement.
[A]MySQL.Data.MySqlClient.MySqlConnection cannot be cast to MySQL.Data.MySqlClient.MySqlConnection. Type A originates from 'MySQL.Data Version 6.9.8.0, Culture=neutral,PublicToken=c5687fc88969c44d' in context 'Default' at location 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\PrivateAssemblies\MySQL.Data.dll'. Type B originates from 'MySQL.Data, Version 6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' in context 'Default' at location 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\MySQL.Data\v4.0_6.9.9.0_c5687fc88969c44d\MySQL.Data.dll'.
==============================================================================

Obviously it is complaining about two different versions of the MySQL.Data.dll 6.9.8 and 6.9.9. What I don't understand though is why or where is it referencing version 6.9.8.0? If I look at my project's references, it is using MySQL.Data.dll version 6.9.9.0. This is a NuGet package at location:

C:\Users\Fabs-LenovoY70\Source\Workspaces\Tracker\Tracker\packages\MySql.Data.6.9.9\lib\net45\MySql.Data.dll

I've search my entire solution for any references to 6.9.8 and I've found nothing. Any ideas? Thank you...
Viewing all 1447 articles
Browse latest View live


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