 |
|
|

|
THank u sir its really help me
|
|
|
|

|
thank u very much for this article.
this help me alot.
|
|
|
|

|
You're welcome
|
|
|
|

|
I'm trying to connect to a remote MySQL server using a C# application. But when I ran the program, I got a runtime error saying it was "Unable to connect to any of the specified MySQL hosts". Now, the host or server has been successfully tested many times with PHP applications (I can connect to it, read & write information etc.),what can I do to connect to www.example.com whiche I have user name and password.
|
|
|
|

|
i understood the default.aspx page but cant find where to place the other two events ,is in insert button or in page load or in datasource button pls reply me its urgent
|
|
|
|

|
You can download the atached source code.
|
|
|
|

|
This is really nice example you have here... But there was one huge disadvantage is that the messages was not long as 200. In this example that is corrected... http://www.simpa.dk/smr/Projects/asp.net/GridView_DataList_MySql/MySQL.zip
|
|
|
|

|
Yeah this example is pretty old
|
|
|
|

|
Hi
I am writing windows mobile6 application, that access the data remotely from mssql server.Here i am using .NET Compact Framewokr 2.0 for developing above application. But i dono How to connect MySQL server remotely ie., I would like connect to it throught Internet from another computer to update database. I installed mysql connector 5.1/net. can you please give me some suggestions for solving the above problem
Thanks & regards
Asif
|
|
|
|

|
I'm sorry but I don't know.
|
|
|
|

|
Thank you very much for this great example
|
|
|
|

|
Hi,
Have u tried connecting Visual basic 6 and Mysql.
I used Mysql-ODBC 3.51 connector for this.
But am getting error like no open cursor .Can u tell me wats the problem in that.
Do u have any code connect visual basic and Mysql,If so can u post it.
I want to get the datas feom vb text boxes and store it in Mysql.
Thanks
|
|
|
|

|
DELIMITER $$
DROP PROCEDURE IF EXISTS `test`.`UpdateMessage` $$
CREATE PROCEDURE `test`.`UpdateMessage`(IN paramkey INT,IN param1 VARCHAR(50),IN param2 VARCHAR(50),IN param3 VARCHAR(200))
BEGIN
UPDATE FROM message
SET Name = param1, Email = param2, Message = param3
WHERE (message.Entry_ID = paramkey);
END $$
DELIMITER ;
Error Message :
Script line: 4 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 'message
SET Name = param1, Email = param2, Message = param3
WHERE (message.E' at line 3
|
|
|
|

|
Hi. Ur source code really very useful. i have tested and it work well. But my objective is make the insert, deleted, show and updated without the stored proceduces in the database.
If i wan to change it from this code which part of the code i need to make adjustment?
|
|
|
|

|
I do not know how to do that.
|
|
|
|

|
Procedure or function 'InsertMessage' cannot be found in database 'test'.
my database is DB_PERFIL and not test!!
how to make choose?
|
|
|
|

|
Change this code:
name="MySQLConnectionString" connectionString="server=localhost;
user id=myuser; password=mypass; database=test; pooling=false;"
providerName="MySql.Data.MySqlClient"
to:
name="MySQLConnectionString" connectionString="server=localhost;
user id=myuser; password=mypass; database=DB_PERFIL; pooling=false;"
providerName="MySql.Data.MySqlClient"
|
|
|
|

|
Very very thanks for this
i have used your code help in the project currently working
hey thanks dude
|
|
|
|

|
Hi there, your code is great and is the base of my current project. Only i'm extremely new and cannot figure out how to create a DataObjectMethod that will select a record by a record ID. This so i can display a selected record from a gridview control in a formview control.
Cheers
|
|
|
|
|

|
Thanks for the reply! I believe when i have the DataObjectMethod i could correctly display the right record in the formview. I'm not quiet that far yet being new and inexperienced my difficulty is in creating selected data method it self, which would have to be similar to your unique data methods using your example with subtle differences as an example:
[DataObjectMethod(DataObjectMethodType.Select)]
public static List GetMessagesByEntryID(EntryID)
{
MySqlCommand cmd = new MySqlCommand("ShowSelectedMessage",
new MySqlConnection(GetConnectionString()));
cmd.CommandType = CommandType.StoredProcedure;
cmd.Connection.Open();
MySqlDataReader dr =
cmd.ExecuteReader(CommandBehavior.CloseConnection);
List MessageItemlist = new List();
while (dr.Read())
{
MessageItem MessageItem = new MessageItem();
MessageItem.Entry_ID = Convert.ToInt32(dr["Entry_ID"]);
MessageItem.Message = Convert.ToString(dr["Message"]);
MessageItem.Name = Convert.ToString(dr["Name"]);
MessageItem.Email = Convert.ToString(dr["Email"]);
MessageItemlist.Add(MessageItem);
}
dr.Close();
return MessageItemlist;
Of course i don't think this would work, it bewilders me as to how you would write such a method. I've tried working off other examples but your methods seem very unique compared with others that either use an MSSQL database or don't use stored pocedures etc. I hope this makes sense.
Cheers again.
|
|
|
|

|
I don't see where you pass the value of EntryID to the ShowSelectedMessage stored procedure.
|
|
|
|

|
Thanks again for replying, i do appreciate it. I think we're really going to see how little I know about all of this now.
I believe, but am probably way off, that i would pass Entry_ID from when selecting a record from the gridview by clicking a asp:hyperlinkfield it will pass the Entry_ID (it would be proID in my case) with the DataNavigateURL so like formviewpage.aspx?Entry_ID={0} and some how I would get that Entry_ID probably with the request.QueryString function on that formviewpage.aspx and send it to the DataObjectMethod perhaps through the objectdatasource which would also have the DataObjectMethod selectmethod as
GetMessagesByID(With something in here probably) returns list if it indeed goes that way.
I know i'm far far out of my level of understanding so understand if you think this is a lost course and don't hesitate to say so. I do appreciate your efforts so far though mate.
|
|
|
|

|
Sorry, i re-read your post and understand what you mean't more. The example of subtle changes to your example was just an indication of what i'm after, i really don't know how to construct a DataObjectMethod like that at all, even from the start. I was wondering if you give an example of one that would work for your example or perhaps a place to go where i could look at theory or syntax behind creating similar DataObjectMethods like yours.
Cheers
|
|
|
|
|

|
Ok cheers mate, thanks for your help.
|
|
|
|

|
Hi,
i need some information on how to make an Form communicate with an MySql database i got running on an server. I'm using Visual Studio 2005. The only thing i need to do with my application is to add 3 items to the DB each time i fill in some txtbox.
Hope for some assitiance in this matter
Thanks in Advance
Ben
|
|
|
|

|
Hi,
I would like to know whether Grid view is the right control to develop the online examination application. The requirements are give below.
For one questions may have multiple choice to select the answers. User need to select one answer(using option button controls) or multiple answers(using checkbox controls) based on the question nature. He/She can also enter the comments about the questions. Such ways that there are multiple questions are available in that online examination.
My question is, Is this the gridview is the right control to implement such application or which is the best approach. Please suggest me. It's very urgent.
Regards
H.Ashok
|
|
|
|

|
Hi, i am facing problem by assigning data into the Detailsview item at insert new record section.
I have a set of data like Username, subject, date, location. I have follow the article above to create the Gridview and Detailsview together with ObjectDataSource.
I have no problem with viewing, editing and deleting. Actually i have no problem with normal inserting but i need to auto assign the username into the detailsview 'username' item after the user click at the New button at the detailsview. So user no need to reenter the data again.
I really no idea on either how to assign the data into the detailsview or direct pass the data to the insert function which located in the class.
Please... anyone can help me??? i really need your valuable guidance and advice. thanks
|
|
|
|
|

|
Thanks for a good sample
In order to get the sample working out of the box, please note that you now need to have a valid ParameterMarker when using procedures and mysql connector/net. This means prefixing parameters where they appear in MessagesDB class with either '?' og '@'. E.g:
change cmd.Parameters.Add(new MySqlParameter("param1
to cmd.Parameters.Add(new MySqlParameter("@param1.
and so on...
It's possible to toggle these values in web.config with 'old syntax=yes', which means '@'. For possible caveats on using one or the other refer to the help file with mysql connector/net.
|
|
|
|
|

|
I have the exact same problem. Is it posible to specify another databse where the stored procedure is stored?
|
|
|
|

|
This is an old article, but I'm going to answer this for anyone who has this problem. If you get this error it is because you don't have SELECT permission on mysql.proc. MySQL provides a workaround. Set UseProcedureBodies to false in your connection string or your MySqlConnectionStringBuilder instance.
|
|
|
|

|
Your code works perfect but I got some promlem when I try to add someting extra on it. I want click a record on the gridview and go to the next page where shows more detailed information about this record. By doing that, I added a stored procedure something like
"select * from users
where ID=variable_ID"
But I don't know how to write the "select" method in the class.
Anybody can help?
|
|
|
|

|
I found a solution here: still use the same data source on the Detailview control. But add "DetailsView1.PageIndex = GridView1.SelectedIndex" on GridView1's "SelectedIndexChanged" event.
|
|
|
|

|
Very good article.
One note though, your database user needs execute rights on the mysql system database to execute stored procedures in any database schema. Otherwise, works brilliantly.
________________________________
Dewald Troskie
GIS Developer, South Africa
"There are 10 kinds of people,
those who understand binary and
thos who don't"
|
|
|
|

|
Thanks about your report!
You know, i make my own project that connect to database and then i want to show my result to form.
my database is made by MySQL4.1 not 5.x.
I have IP:192.168.1.109, but i use localhost.
how can i make it. i try to connect but i got a recive mess "Unable to connect to any of specified my SQL hosts."
How can i fix it?
hoanglk
|
|
|
|

|
I had the same problem.
I declare my connection string in the web.config file
as:
connectionString="server=localhost; user id=root; password=******; database=amos; pooling=true; port=3306" providerName="MySql.Data.MySqlClient"/>
And take it into my application with:
ConfigurationManager.ConnectionStrings["MySQLConnectionString"].ConnectionString;
But it does not work.
Does anybody know what to do?
StormTrooper
|
|
|
|

|
i thing so mysql under the version 5.0 doesnt support stored procedure
|
|
|
|

|
Are you you handling nulls that are returned? I always try and use the isDbNull so I don't get blowups.
http://peterkellner.net
|
|
|
|

|
I was trying to keep the tutorial simple but I probably should have put a null handler such as: private static object GetNull(object Field) { return Null.GetNull(Field, DBNull.Value); }
|
|
|
|

|
Thanks for posting. I developed ASP.NET 1.1 apps with MySQL for about 2 years. I finally went over to MS-SQL for several reasons:
-More seamless design-time support (drag-and-drop tables to datasets and datagrids)
-.NET/Connector (in)stability: as I would follow their minor revisions, bugs would appear in their connector. A recent example: retrieving an @@IDENTITY value after an insert yields incorrect values in certain situations. I have a bug report submitted on that one.
-And most importantly, the MySQL license. You may think you're getting a "free" database with MySQL. But if you correspond with them and read their Commercial license, you'll realize that using MySQL with an app you write and hope to sell is not free, at least if you don't want to GPL your source code. You have to pay them a $395 license fee if you want to even "link" to a MySQL database (including just using their .NET/Connector libraries). If your apps are hosted on different servers (even if its the same hosting provider), you're looking at another $395 per license. You could encounter this if you re-sell the same app to different customers who want their own hosted instantiation.
Here is the
link to their commercial license concepts.
-- modified at 13:36 Sunday 28th May, 2006
|
|
|
|

|
Wow. Thanks for the info on the license deal. Saved me a lot of trouble possibly. I'm sticking to .mdb files with DB_CONNECT = "Provider=Microsoft.Jet.OLEDB.4.0. Just can't have con-current updates.
|
|
|
|

|
Most hosting providers offer MS-SQL database for about $10/month. If you're building an ASP.NET app that may have multiple people using it at the same time (even just 2), do yourself a favor and just use MS SQL rather than Access. You'll thank yourself for it.
|
|
|
|

|
I couldn't have done better self. I write a blog on MySQL and ASP.NET, and I have pointed to this article as reference (http://electronucleus.blogspot.com/).
Well done.
________________________________
Dewald Troskie
GIS Developer
"There are 10 kinds of people,
those who understand binary and
thos who don't"
|
|
|
|

|
Thank you
|
|
|
|

|
But, ObjectDataSource has a bug about Localizated applications for decimal and DateTime formatting.
I'm waiting for a bugfix.
Bacos
|
|
|
|
 |