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

GetSchema (1 reply)

$
0
0
Does anyone have an example, using VB.NET, of walking through a connection and getting a list of the table names?

This DOES NOT work:
***************************************
'Connect to the database
Dim cnStr As String = "server=localhost;user=myself;database=test;password=whatever"
Dim MyConn As MySqlConnection = New MySqlConnection(cnStr)

MyConn.Open()

Dim tableData As DataTable = cnRead.GetSchema

For Each row In tableData.Rows
MsgBox(tableData.TableName)
Next
*****************************************

All I get from the message box is "MetaDataCollections" for each element.

HELP for creating view (1 reply)

$
0
0
sir
i want to creat view in mysql server but ther is error --> error HRESULTE_FAIL has been returned from call to COM Component -->
So please any one help me in this sunject

Timeout...obtaining a connection from the pool (1 reply)

$
0
0
I have been having this issue for quite some time and it's driving me bonkers. I recently changed some configuration parameters on our MySQL database server to hopefully stop this from happening, and it did not help. Every once in a while when someone does something repeatedly (like Log in to school account, submit invoice, log out, log into different school account, submit invoice, logout, over and over), I will then get this error:

MySql.Data.MySqlClient.MySqlException: error connecting: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.

The database is on an Ubuntu Linux server. The application is on a Windows Server 2003 server. I recently changed the database configuration:

innodb_additional_mem_pool_size=512M
innodb_log_buffer_size=8M
innodb_buffer_pool_size=256M
innodb_thread_concurrency=0

This is similar to settings I have on a Windows Server that is working perfectly.

To fix this problem, I have to recycle the memory pool in Windows IIS, then it works well for a while until someone does this again. Any ideas?

Thanks,
Jesse

Problem with MySQLTransaction and Triggers (6 replies)

$
0
0
Hi.

I´m getting an error when I execute an Insert or Update query if I do it with transactions and the table has a trigger. The error message is:

"The user specified as a definer ("@") does not exist"

but if I delete the trigger the query works properly.

The version of my SQL is "5.1.32" and the MySQLConnector .NET is "6.4.3"

I hope anyone can help me.

Thanks and regards.

To install MS SQL2008 in windows 7 (1 reply)

$
0
0
How to install MS SQL 2008 in windows 7

VS2010, EntityFramework, gridviews (no replies)

$
0
0
Dear Forum
As a total newbie, I use VS2010 to create an ASP.NET Salesdesk survey and use EntityFramework & Connector to create a GRIDVIEW to pull data into a page to display the last 15 records of the survey. This works well.

I now need to search the data in the Grid for customer emails, and provide show only data between two dates, which I must get from two textbox user inputs.
Am I on the right track ot put userinput into variables and use the variables as parameters in Entitydatasource (the datasource for the grid)?

Is there any other way than using VS's databound controls such as gridviews, which aren't messy.

Need help : What'is the problem with my query? (no replies)

$
0
0
Assalamu'alaikum,


I've run this query in sql server and it's works. But not works in mysql at DBMS such as sqlyog and phpmyadmin. This is my query :

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
SELECT COUNT(mydate) AS number, CONVERT(VARCHAR(10), GETDATE(10) mydate, 101) AS mydate
FROM sale WHERE CONVERT(VARCHAR(10), mydate, 101) = CONVERT(VARCHAR(10), GETDATE(), 101)

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

And this is error message at mysql DBMS :
_________________________________________________________________________________

Error Code: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VARCHAR(10), GETDATE(10) mydate, 101) AS mydate
FROM sale WHERE CONVERT(' at line 1
_________________________________________________________________________________

I hope there are anyone whocan help me. I would be very happy. Thankyou.

What is the best way to start learning Dot Net? (2 replies)

$
0
0
I want to learn Dot Net but i don't know how to begin with it. I want to know the way to learn it and good sources for it (books and websites).

.NET Connector -Dae/Time Serialization error (no replies)

$
0
0
I am using .NET Connector 6.5.4 & Visual Studio 2010 Web developer Express. I am updating a row in a table which has a column of datatype DATETIME. I passed value "03/30/2001 12:00:00 AM" and it threw an exception saying

{"Fatal error encountered during command execution."}
Unable to serialize date/time value.

I am not able to resolve it. From the forum posts I learned that there was fixed applied to 6.3.3 so I believe this is already fixed in the latest version I am using 6.5.4. Please help.

connector export results to csv output (no replies)

$
0
0
Hi, I am trying to get a script to work with the latest connector in windows and powershell 2. I seem to have a working script in powershell using the connector. (Example below.) and I can see my results in the powershell console and screen, but every way I try to export my results to csv or pipe to text I keep getting no data. It sounds like an easy fix but no luck so far. Any help or ideas appreciated. I tried piping export-csv and out-file combination and also calling the script as a function -- with no luck.


[void][system.reflection.Assembly]::LoadFrom("C:\Program Files\MySQL\MySQL Connector Net 6.5.4\Assemblies\v2.0\MySQL.Data.dll")
[void][System.Reflection.Assembly]::LoadWithPartialName("MySql.Data")

clear-host
$connect = New-Object MySql.Data.MySqlClient.MySqlConnection
$connect.ConnectionString = "server=$IP;uid=$USER;pwd=$PASS;database=$DB"
$connect.Open()


$command = New-Object MySql.Data.MySqlClient.MySqlCommand
$command.Connection = $connect
# $command.CommandText = "desc $TABLE"
$command.CommandText = "select COL1,COL2 from TABLE"
$reader = $command.executereader()
while($reader.Read()) {
$reader.GetString(0) + "," + $reader.GetString(1)
}

$connect.Close()

Is MySql connector supporting Output parameters for CommandType.Text ? (no replies)

Very slow opening connection (no replies)

$
0
0
I am trying to solve the problem of very long response times from MySQL when opening a connection using the MySQL Connector for .net.

I have installed MySQL 5.5 running on an Azure VM (Server 2008) with --skip-name-resolve, and the database user accounts' host restrictions are using IP addresses. I am using the latest MySQL Connector for .net in my WCF service running on Azure (in the same location US- East, I have been using a trial subscription, no affinity set). My connection string in the WCF service is using the internal IP address of the VM hosting MySQL as the server parameter value. I also have "pooling = true;Min Pool Size=2;" just in case (I have tried without these parameters too).

When tracing the WCF the query response time once the service is running and processing requests are pretty good (even where each query result is unique and so not being cached) and I have no issues with the performance of MySQL providing it's getting hit frequently.

But the huge problem I haven't been able to crack is the length time it takes to get the connection to MySQL Open after no calls to the database have been made for about 3 or 4 minutes. If no database calls are made for a few minutes it takes 8 or 9 seconds or more to open the connection again. I wrapped the actual "conn.open();" with trace statements before and after calling, and this is the behaviour I am seeing logged time and time again after a few minutes of inactivity.

Incidentally, I have also tried (and still am using) the 'using' style of connection handling to ensure that the MySQL Connector is managing the connection pool.

e.g.:
using (var conn = new MySqlConnection(Properties.Settings.Default.someConnectionString)) { ... statements ..}

I feel like I have reached a dead end on this one so any suggestions would be greatly appreciated.

Formatting Query in .Net (9 replies)

$
0
0
I'm trying to execute an insert query where I do a select and select the records where userId is in the userIds I pass in.

This is the error:
Truncated incorrect DOUBLE value: '1,2'"

I get the error because in my code, the query comes out looking like this:
INSERT INTO Table1(DisciplineId, UserId) (SELECT 1, UserId FROM Users WHERE UserId IN ('1,2'))

I need to know how to get the query to be formatted without the single quotes around the 1,2. How can I change my code to get that result?


My code:

long recordsAffected = 0; 

String connectionString = ConfigurationManager.ConnectionStrings["MyDB"].ConnectionString;
MySqlConnection conn = new MySqlConnection(connectionString); 
String sql = "INSERT INTO facilitators (DisciplineId, UserId)" 
    + " (SELECT ?disciplineId, UserId FROM Users" 
    + " WHERE UserId IN (?facilitators))"; 

try 
{ 
    using (conn) 
    { 
        conn.Open(); 
        using (MySqlCommand cmd = new MySqlCommand(sql, conn)) 
        { 
            cmd.CommandType = System.Data.CommandType.Text; 
            cmd.Parameters.AddWithValue("?disciplineId", disciplineId); 
            cmd.Parameters["?disciplineId"].Direction = System.Data.ParameterDirection.Input;
            cmd.Parameters.AddWithValue("?facilitators", facilitators); 
            cmd.Parameters["?facilitators"].Direction = System.Data.ParameterDirection.Input;
            recordsAffected = cmd.ExecuteNonQuery(); 
        } 
    } 

    return recordsAffected; 
}

Please more info about the new "Table Caching" feature (1 reply)

$
0
0
Could anybody be so kind provide us more detailed information and examples of the new "Table Caching" feature? Thanks.

Connector .NET 6 and MySqlTransactions (4 replies)

$
0
0
How does one use a transaction in conjunction with MySqlHelper? The examples I've found are standard to create a connection, create a command, create a transaction...etc. Does MySqlHelper support a more streamlined methodology and still manage a connection pool for efficiency?


Thanks in advance,

Sn

Connection problems (ADO.Net EF vs. MySQL 5.1) (no replies)

$
0
0
I'm adding ADO.Net Entity Data Model object to ASP.Net MVC 3 project. I'm using Entity Data model Wizard.

1) First I select option Generate from database.

2) In second phase I manage to get connection to database.

3) In third step "Choose your database objcets" i'm getting error:
"... The inner exception caught was type 'MySql.Data.MySqlClient.MySqlException', with this error message: 'Column count of mysql.proc is wrong. Expected 20, found 16. The table is probably corrupted'."

I get this same error messages no matter what I do with the database. Even if it's empty it says "The table is probably corrupted".

Database connector is version 6.4.5
MySQL version is 5.1
Entity Framework is version 4.1.0.0

Erro ao conectar [Servidor Proxy] (no replies)

$
0
0
Bom dia.

Estou desenvolvendo uma aplicação .NET Windows Forms, e utilizando um BD da Web em MySQL.
Quando eu rodo no meu notebook particular funciona direitinho, porém quando testo na máquina do trabalho, onde será usado, não funciona.

Apresenta o seguinte erro: "Unable to connect to any of the specified MySQL hosts".

Alguem já passou por isso? Será que há uma forma de através da string de conexão eu conseguir acesso até o BD web?

A string que estou usando esta ex: Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;

Obrigado, Abraços.

An existing connection was forcibly closed by the remote host (3 replies)

$
0
0
Hi,

We are using an in house written WPF application which uses .Net Connector 6.3.4. The MySql database is running on SBS 2011 Standard.

Problem Description
The application has been working fine for months but starting last week we started to get a problem whereby people working externally could no longer open a connection to the database. To be more specific only one external user at a time could connect, numerous users were connected fine from within the domain.

The exeption occurrs on the Open
MySqlConnection conn = new MySqlConnection(SerGlobals.ser_connection);
conn.Open();

Exception : Reading from the stream has failed.
Inner Exception : Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.

Detailed Execption:
MySql.Data.MySqlClient.MySqlException (0x80004005): Reading from the stream has failed. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
--- End of inner exception stack trace ---
at MyNetworkStream.HandleOrRethrowException(Exception e)
at MyNetworkStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at MySql.Data.MySqlClient.TimedStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at System.IO.BufferedStream.Read(Byte[] array, Int32 offset, Int32 count)
at MySql.Data.MySqlClient.MySqlStream.ReadFully(Stream stream, Byte[] buffer, Int32 offset, Int32 count)
at MySql.Data.MySqlClient.MySqlStream.LoadPacket()
at MySql.Data.MySqlClient.MySqlStream.LoadPacket()
at MySql.Data.MySqlClient.MySqlStream.ReadPacket()
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.GetPooledConnection()
at MySql.Data.MySqlClient.MySqlPool.TryToGetDriver()
at MySql.Data.MySqlClient.MySqlPool.GetConnection()
at MySql.Data.MySqlClient.MySqlConnection.Open()
at MySqlTest.MainWindow.test_Click(Object sender, RoutedEventArgs e) in D:\Development\c#\MySqlTest\MySqlTest\MainWindow.xaml.cs:line 40MySql.Data.MySqlClient.MySqlException (0x80004005): Reading from the stream has failed. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
--- End of inner exception stack trace ---
at MyNetworkStream.HandleOrRethrowException(Exception e)
at MyNetworkStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at MySql.Data.MySqlClient.TimedStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at System.IO.BufferedStream.Read(Byte[] array, Int32 offset, Int32 count)
at MySql.Data.MySqlClient.MySqlStream.ReadFully(Stream stream, Byte[] buffer, Int32 offset, Int32 count)
at MySql.Data.MySqlClient.MySqlStream.LoadPacket()
at MySql.Data.MySqlClient.MySqlStream.LoadPacket()
at MySql.Data.MySqlClient.MySqlStream.ReadPacket()
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.GetPooledConnection()
at MySql.Data.MySqlClient.MySqlPool.TryToGetDriver()
at MySql.Data.MySqlClient.MySqlPool.GetConnection()
at MySql.Data.MySqlClient.MySqlConnection.Open()
at MySqlTest.MainWindow.test_Click(Object sender, RoutedEventArgs e) in D:\Development\c#\MySqlTest\MySqlTest\MainWindow.xaml.cs:line 40
System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
--- End of inner exception stack trace ---
at MyNetworkStream.HandleOrRethrowException(Exception e)
at MyNetworkStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at MySql.Data.MySqlClient.TimedStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at System.IO.BufferedStream.Read(Byte[] array, Int32 offset, Int32 count)
at MySql.Data.MySqlClient.MySqlStream.ReadFully(Stream stream, Byte[] buffer, Int32 offset, Int32 count)
at MySql.Data.MySqlClient.MySqlStream.LoadPacket()MySql.Data.MySqlClient.MySqlException (0x80004005): Reading from the stream has failed. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
--- End of inner exception stack trace ---
at MyNetworkStream.HandleOrRethrowException(Exception e)
at MyNetworkStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at MySql.Data.MySqlClient.TimedStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at System.IO.BufferedStream.Read(Byte[] array, Int32 offset, Int32 count)
at MySql.Data.MySqlClient.MySqlStream.ReadFully(Stream stream, Byte[] buffer, Int32 offset, Int32 count)
at MySql.Data.MySqlClient.MySqlStream.LoadPacket()
at MySql.Data.MySqlClient.MySqlStream.LoadPacket()
at MySql.Data.MySqlClient.MySqlStream.ReadPacket()
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.GetPooledConnection()
at MySql.Data.MySqlClient.MySqlPool.TryToGetDriver()
at MySql.Data.MySqlClient.MySqlPool.GetConnection()
at MySql.Data.MySqlClient.MySqlConnection.Open()
at MySqlTest.MainWindow.test_Click(Object sender, RoutedEventArgs e) in D:\Development\c#\MySqlTest\MySqlTest\MainWindow.xaml.cs:line 40MySql.Data.MySqlClient.MySqlException (0x80004005): Reading from the stream has failed. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
--- End of inner exception stack trace ---
at MyNetworkStream.HandleOrRethrowException(Exception e)
at MyNetworkStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at MySql.Data.MySqlClient.TimedStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at System.IO.BufferedStream.Read(Byte[] array, Int32 offset, Int32 count)
at MySql.Data.MySqlClient.MySqlStream.ReadFully(Stream stream, Byte[] buffer, Int32 offset, Int32 count)
at MySql.Data.MySqlClient.MySqlStream.LoadPacket()
at MySql.Data.MySqlClient.MySqlStream.LoadPacket()
at MySql.Data.MySqlClient.MySqlStream.ReadPacket()
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.GetPooledConnection()
at MySql.Data.MySqlClient.MySqlPool.TryToGetDriver()
at MySql.Data.MySqlClient.MySqlPool.GetConnection()
at MySql.Data.MySqlClient.MySqlConnection.Open()
at MySqlTest.MainWindow.test_Click(Object sender, RoutedEventArgs e) in D:\Development\c#\MySqlTest\MySqlTest\MainWindow.xaml.cs:line 40
System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
--- End of inner exception stack trace ---
at MyNetworkStream.HandleOrRethrowException(Exception e)
at MyNetworkStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at MySql.Data.MySqlClient.TimedStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at System.IO.BufferedStream.Read(Byte[] array, Int32 offset, Int32 count)
at MySql.Data.MySqlClient.MySqlStream.ReadFully(Stream stream, Byte[] buffer, Int32 offset, Int32 count)
at MySql.Data.MySqlClient.MySqlStream.LoadPacket()
System.Net.Sockets.SocketException (0x80004005): An existing connection was forcibly closed by the remote host
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)

This is the first connection attempt by our software.

Using a network monitoring tool (Wireshark) I can see the successful connection coming through with all the expcected flags, data etc.
TCP [SYN]
TCP [ACK]
MySQL Login Request

But on the failed connection I can see the following :
TCP [SYN]
TCP [ACK]
TCP [RST]

I have also tried using Telnet, and MySQL Workbench and both fail if there is already an external connection, i.e. from outside the domain.

Can anyone help with his, I have been banging my head against brick wall for the last week trying to resolve this.

Thanks,

Steve Perrins

MySQL Connector/Net executing extra actions on database servers while running simple select statements (5 replies)

MySQL views and Entity Framework (6 replies)

$
0
0
I imported my mysql database into an entity model in Visual Studio 2012 using .Net framework 4.5. All the tables appear and are accurate. I cannot see any of the views as being imported. Are they not supported?
Viewing all 1447 articles
Browse latest View live