Databases :: MySQL Must Use ODBC Connector - Trying To Pass Parameters?
Jan 19, 2010
I am with GoDaddy (yeah, yeah, don't want to hear it) and must use ODBC to connect to my MySQL database. The connections are working fine but I have a GridView/DetailsView parent/child relationship set up between 3 pages. I know that these pages worked with a .NET Connector locally but after I changed them to ODBC, I only get the first part of the page, nothing that depends on data being selected works. This has led me to believe that I must alter the way I pass parameters to the next request page. I have read some things about using a question mark but I cannot figure out how I should apply it to my page as most examples are in C# or VB. My page is mostly pure ASP.NET and I'm not sure if I still continue to utilize the asp:ControlParameter. the code below.
how to get GoDady to alter their medium trust to accept sockets???? That's all it would take
This is the page my employees will use to view the people in the database and then select them and have a details view of that particular cust_code (customer code) pop up to the right of the gridview:
[Code]....
This is the page ( UpdatePrefCustomers.aspx ) that my employees, who will be allowed access it (yes, I already know how to apply authorization but will do it last before deployment so it doesn't drive me crazy when I preview in browser), will use to add, edit, and delete from the database. It must be accessed first and the other two pages, prefcust_edit.aspx and prefcust_insertt.aspx are called from it by passing the parameter cust_code:
I am currently making a website on asp.net and i am creating methods using TableAdapter. I am connected to MySql using an ODBC connection. The select * from department will work perfectly for me but when trying to use parameters i am given an error message on the wizard. select * from department where name = @name gives me the error: Error in where clause near '@' unable to parse query text. also tried select * from department where name = ?: this gives me the error: No mapping exists from dbTypeObject to a known Odbc type.
I just moved to a new 2008 64 Bit Server. We are using MySQL, now also the 64 Bit version. Now I found out that there is a 64 Bit ODCB Driver, but not an 64 Bit Net/Connector.
Is that an issue or is the .NET Connector by default 32 and 64 Bit?
environment: W7 Ultimate 64, VS2008, Mysql 5.1.45, Connector .Net 6.2.2
.aspx environment: a DropDownList (DDL) triggers a DetailsView (DV). All functions (select, edit, new ...etc) work fine.
Now, in the same .aspx page I use Event "SQLDSDVKlient_Inserted" to get the Last inserted record ID using "ExecuteScalar" method! This to fill the DV with the just created record using "New" (see code below).
on "cnn.Open()" I get below error msg; Event code 3005!
Some additional info:
a) keep in mind this all happens in the same .aspx page b) In the MySQL wizard (5.1.45) I clicked the "allow remote connections". c) the ConnectionString is copied out of web.config (remind you: all 'normal' DV functions work fine.I.e. I certainly can connect to my MySQL DB.) d) When using, in ConnectionString, the parameters "Allow User Variables=True;old guids = true" I get, on statement "cnn = New Data.SqlClient.SqlConnection(connString)" a msg: Keyword not supported"; so I removed it. e) without above connectionstring parm I get on statement "cnn.Open()" below error msg: where I need help!
Questions:
1) why does the system suddenly bring the remote connection into play?; I'm always on the same machine, same .aspx page! 2) what is the role of the "mysql connector.net" (6.2.2) in this scenario ?
I have Connector/NET working on my windows 2008 web server. We are moving the MySQL DB from localhost on that windows 2008 server to a new Linux server. The tables are copied over. I can connect to them in the cmd line using all the same credentials.
When I try to connect via my ASP.NET application I get the ambiguous Error:
"Unable to initialize provider. Missing or incorrect schema."
I have a problem that I can't figure out. I shall read an images from a column in a MySQL database. I use a simple aspx page and the codebehind file with the code below.
It is ok to read the image if I don't use any parameter value in the where clause, but if I use it, nothing is returned. I don't know if I have done anything wrong in the code. I have also tried to set a proper value on the parameter.value without success. So my conclusion is that the parameter sertup is wrong in my code.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim PictureID As Integer = Convert.ToInt32(Request.QueryString("id")) 'Connect to the database and bring back the image contents & MIME type for the specified picture
I'm having problem on passing parameter on odbc because it's not working at all. I tried this using sql and I have no problem at all. All are working fine. Is there a different syntax on odbc? Here's my code:
[Code]....
Or using mysql connector/net to use mysql. I'm having problem installing it because the visual studio integration is not working, so I can't find it on the data source provider.
I am trying to make connection to a remote database server and I am getting the following message. I think i have to grant access to the client maching from my database server.. How do i grant access to an ip addess?
ERROR [HY000] [MySQL][ODBC 5.1 Driver]Access denied for user 'thelp'@'123.29.14.30' (using password: YES) ERROR [HY000] [MySQL][ODBC 5.1 Driver]Access denied for user 'thelp'@'123.29.14.30'(using password: YES)
System.Data.Odbc.OdbcException: ERROR [HY000] [MySQL][ODBC 3.51 Driver]Can't connect to MySQL server on '127.0.0.1' (10048)ERROR [HY000] [MySQL][ODBC 3.51 Driver]Can't connect to MySQL server on '127.0.0.1' (10048)
when i specify values in my update query the query works fine and the database gets updated, but when i use parameters in my query the database does not update here is the code i have written
I have a problem whenever i run my code i get the following error ERROR [42000] [MySQL][ODBC 3.51 Driver][mysqld-5.1.46-community]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 ' ('b'), ('Manager'), ('c'), ('d'), ('e')' at line 1 my code works with connector/net but my host does not have it installed so i've had to change my code to odbc which they do have, i have found out the syntax is different and changed my code accordingly my code is as follows
I can check whether username exists or not successfully but not for email. any ideas why it isn't working? Error message was that i did not close my connection. using System;
I am using ODBC command and adding parameters to it. But it always keeps on saying procedure proc_Update expects a parameters @id which was not supplies ( this errors comes for all the paramters that I add).
I have a page 3 datacontrols (in order, datalist->grid->listview, the selection from one feeds into the next) works perfectly locally, using dot net connector for mysql. My webhost uses ODBC, and I had to remove [ ] from the select statements in my code and put the table names. I removed the [ ] 's and my page runs, and my 1st/datalist control shows but now my "selected value" of my datalist, doesn't populate my grid control. I imagine theres another peculiarity with the way odbc handles parameters. Here is my original, for my grid:
<asp:SqlDataSource ID="recipegrid" runat="server" ConnectionString="<%$ ConnectionStrings:exoticingConnectionString %>" ProviderName="<%$ ConnectionStrings:exoticingConnectionString.ProviderName %>" SelectCommand="SELECT [Id], [Name], [Cal], [Pro], [Fat], [Carb], [Fiber], [Chol], [Sod] FROM [tblrecipes] WHERE ([filenameid] = @filenameid) ORDER BY [name]"> <SelectParameters> <asp:ControlParameter ControlID="DataList1" Name="filenameid" PropertyName="SelectedValue" Type="Int32" /> </SelectParameters> </asp:SqlDataSource>
example of changes to select that allowed my page to run again: SelectCommand="SELECT tblrecipes.Id, tblrecipes.Name, tblrecipes.Cal, tblrecipes.Pro, tblrecipes.Fat, tblrecipes.Carb, tblrecipes.Fiber, tblrecipes.Chol, tblrecipes.Sod FROM tblrecipes WHERE tblrecipes.filenameid = @filenameid ORDER BY tblrecipes.name">
BTW, I also tried removing my scriptmanager & updatepanel,, and using autopostbacks instead in my controls, jik, and nothing changed so I put it back.
I have installed MySQL and set up an ODBC driver to point to a database in MySQL. In ASP.NET I have defined a connection string to attach to this MySQL dtabase.
However in ASP.NET connection wizard, although the tables are shown, no colums are shown and when I attempt to run the page which uses this datasource I get an error message about a syntax error near page 1 at 'Select * from [categories]'. how to use an ODBC (MySQL) datasource in ASP.NET?
my webserver is in the DMZ. The Database in the intranet. For connection from webserver to database the following entry is made in the odbc connection "TCPIP BCAST=NO;HOST=Intranet.Firma.local,Intranet_Spiegel.Firma.local,Intranet_Arbiter.Firma.local;PORT=2639}"
how to get this options in the connection strings working, or how i must modify the entitiy framework connection string to use the odbc entry?
My local computer is 64 bit but the downloads for the .Net mySql connector found here:[URL]are 32 bit. I installed the 32 bit file however, whenever I try to input any new connector information after the 1st keystroke the box disappears. So I'm assuming that it has more to do with my machine being 64 bit rather than 32. Is there a 64 bit version of this connector?
UPDATE:
It is the Add a Connection box.
After I enter anything into any of the textboxes the above box just disappears.
I'm trying to connect my app to my database hosted on my web space. I have a newbie query.Do I have to install Connector/Net 6.8.3 on my web space's server, or, can I install it locally and just change a config file of some sort on my server version? If the latter is possible, what is my best (and easiest) way of developing / testing in two DB environments? the testing server will be my online one so I don't mind having to manually edit something each time after I publish it.
My code is to update a record if it already exists in database else insert as a new record. My code is as follows:
protected void Button3_Click(object sender, EventArgs e) { OdbcConnection MyConnection = new OdbcConnection("Driver={MySQL ODBC 3.51 Driver};Server=localhost;Database=testcase;User=root;Password=root;Option=3;"); MyConnection.Open(); String MyString = "select fil_no,orderdate from temp_save where fil_no=? and orderdate=?"; OdbcCommand MyCmd = new OdbcCommand(MyString, MyConnection); MyCmd.Parameters.AddWithValue("", HiddenField4.Value); MyCmd.Parameters.AddWithValue("", TextBox3.Text); using (OdbcDataReader MyReader4 = MyCmd.ExecuteReader()) { //** if (MyReader4.Read()) { String MyString1 = "UPDATE temp_save SET order=? where fil_no=? AND orderdate=?"; OdbcCommand MyCmd1 = new OdbcCommand(MyString1, MyConnection); MyCmd1.Parameters.AddWithValue("", Editor1.Content.ToString()); MyCmd1.Parameters.AddWithValue("", HiddenField1.Value); MyCmd1.Parameters.AddWithValue("", TextBox3.Text); MyCmd1.ExecuteNonQuery(); } else { // set the SQL string String strSQL = "INSERT INTO temp_save (fil_no,order,orderdate) " + "VALUES (?,?,?)"; // Create the Command and set its properties OdbcCommand objCmd = new OdbcCommand(strSQL, MyConnection); objCmd.Parameters.AddWithValue("", HiddenField4.Value); objCmd.Parameters.AddWithValue("", Editor1.Content.ToString()); objCmd.Parameters.AddWithValue("", TextBox3.Text); // execute the command objCmd.ExecuteNonQuery(); } } }
I am getting the error as: ERROR [42000] [MySQL][ODBC 3.51 Driver][mysqld-5.1.51-community]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 'order,orderdate) VALUES ('04050040272009',' &' at line 1
The datatype for fields in table temp_save are:
fil_no-->INT(15)( to store a 15 digit number) order-->LONGTEXT(to store contents from HTMLEditor(ajax control)) orderdate-->DATE(to store date)
I just downloaded and installed the most recent MySQL .net connector, 6.3.6 and it connects to the DB just fine. My problem is with the web.config settings I have set for it. It seems that theMinRequiredNonAlphanumericCharacters property is hard coded to '1'.I've changed this to 0, 5, or any other number. I even setup a web page to just display the properties of the provider. If I change the values in the web.config, the values update. It seems that MinRequiredNonAlphanumericCharacters won't change.
[Code]....
Again, the DB connection works just fine, reason I did not post the connection string. The min password length at 44 was just for testing.
[Code]....
Of the three I only tested, only MinRequiredNonAlphanumericCharacters stays at '1' no matter what I change it to in the web.config. I even changed it to 'abcd' and received no .NET runtime errors. Me thinks it is hard coded some where or I'm not using the right property name in the web.config. I copied the web.config value straight from the example in the documentation that came with the MySQL .net connector.
I'm thinking the problem here is with my SQL Syntax, but I'm not sure and need a fresh pair of eyes to check it out. This is the code I'm using to connect to and then insert into the DB:
I created a DSN to the database, which is hosted on my machine. When I run the application I get this error:
ERROR [42000] [MySQL][ODBC 3.51 Driver][mysqld-5.1.51-community]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 'key, secretkey, uid) VALUES ('127090765-i3aZl71LPSVUCPZs9kHSYeBli0vWpbq0BaM1roYC' at line 1
But for the life of me I can't figure out what's wrong with my syntax...It's prolly something simple, but again, I need a pair of fresh eyes to look at this.
how to connect ASP to MySQL database. I have already install MySQL in my localhost, Add a connection through Data Source (ODBC) in ctrl panel and test connection succeed. Now I want to show the query on my default.aspx page so that I can do the insert / update / delete my table data in MySQL.
I have used ASD.NET code using SQL Database for Transaction operation successfully. By changing the Database Code to interface with MYSQL an Error occurs. If I remove the Transaction Code from within the the application, it works OK by displaying the MYSQL data (Read Only) in the layout of the application. I am using Mysql Essential-4.1.22-win32 and MYSQL Connector ODBC-3.51.2. My objective is to EDIT the MYSQL Data.