MySql membership and roles


I thought I'd give MySql a go, but I'm having no luck at all getting membership and roles working. I'm using MySql 5.1 and Connector/.Net 5.1.3 and Visual Studio 2005.

I've created a database using MySql Admin and added the following to web.config:












I've also added the two .dlls (MySql.Data.dll and MySql.Web.dll) into the site's bin folder per someone's suggestion on another forum.
When trying to test the connection using the asp.net web site administration tool (after selecting MySqlMembershipProvider and MySqlRoleProvider) I get an error message stating that it couldn't establish a connection to the database.Using Visual Studio 2005 server explorer, however, I am able to connect to the database using the connection info listed above and interact with it...creating tables, adding data, etc.;

When I check the event viewer, I see the following:

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.OpenPacket()
at MySql.Data.MySqlClient.NativeDriver.Authenticate411()
at MySql.Data.MySqlClient.NativeDriver.Authenticate()
at MySql.Data.MySqlClient.NativeDriver.Open()
at MySql.Data.MySqlClient.MySqlPool.GetPooledConnection()
at MySql.Data.MySqlClient.MySqlPool.GetConnection()
at MySql.Data.MySqlClient.MySqlConnection.Open()
at MySql.Web.Security.MySQLMembershipProvider.GetUsers(Int32 pageIndex, Int32 pageSize, Int32& totalRecords)

Can anyone point me in the right direction
Posted On: Wednesday 7th of November 2012 11:12:20 AM Total Views:  178
View Complete with Replies

RELATED TOPICS OF Oracle PROGRAMMING LANGUAGE




connection string problem asp.net with mysql?

.................. i have used the following connection string, but it only works for localhost, when i am trying to upload it on server it gives error.,error is specied below..it urgent plz resolve as soon as possible... \t\t \t\t Error - Unable to connect to any of the specified MySQL hosts. Exception Details: MySql.Data.MySqlClient.MySqlException: Unable to connect to any of the specified MySQL hosts. \t\t
VIEWS ON THIS POST

247

Posted on:

Wednesday 7th November 2012
View Replies!

insert into mysql

I am new to asp.net but familiar with asp. I have a page with the following code... \t protected void Page_Load(object sender, EventArgs e) \t { //String strUserID = (String) Session["id"]; //Dim strGuid = fnGuid() \t // The EAFlashUpload control sends files in separate requests, \t // so below code is executed for each file. \t // define folders for files storing. \t string UploadFolder = Server.MapPath("") + "\\pics\\"; \t // check if file persits in the request and \t // if above condition is true store file to UploadFolder location \t if (Request.Files != null && Request.Files.Count > 0) \t { \t HttpPostedFile uploadedFile = Request.Files[0]; \t try \t { // Get the GUID \tstring guidResult = System.Guid.NewGuid().ToString(); \t \t// Remove the hyphens \tguidResult = guidResult.Replace("-", ""); \t \t// Make sure length is valid \t//if (length 9) \t // throw new ArgumentException("Length must be between 1 and 9"); \t \t// Return the first length bytes \tguidResult = guidResult.Substring(0, 4); string userid = ""; userid = Request.Form["file_userid"]; \t //Storing the file \t uploadedFile.SaveAs(UploadFolder + userid + "-" + guidResult + "-" + Path.GetFileName(uploadedFile.FileName)); \t // retrieve a file description \t string fDescription = ""; \t if (Request.Form["file_Description"] != null) \t { \t fDescription = Request.Form["file_Description"]; \t // some useful code, ex: storing description into DB "-" + guidResult + \t } \t Response.Write(String.Format("User number" + userid + " The file \"{0}\" has been uploaded Description: {1} ", Path.GetFileName(uploadedFile.FileName), fDescription)); \t // The following code is related to UploadDescription.html example only // \t if (Request.Form["menu"] != null) \t { \t Response.Write("Some menu: " + Request.Form["menu"].ToString() + ""); \t } \t if (Request.Form["author"] != null) \t { \t Response.Write("Author: " + Request.Form["author"].ToString()); \t } \t // The above code is related to UploadDescription.html example only // \t Response.Write(""); \t } \t catch(Exception ex) \t { \t Response.Write(String.Format("An error occured during file handling: {0}", ex.Message)); \t } \t } \t else \t { \t Response.Write("The file has not been sent."); \t } \t } \t protected void Page_Load(object sender, EventArgs e) \t { //String strUserID = (String) Session["id"]; //Dim strGuid = fnGuid() \t // The EAFlashUpload control sends files in separate requests, \t // so below code is executed for each file. \t // define folders for files storing. \t string UploadFolder = Server.MapPath("") + "\\pics\\"; \t // check if file persits in the request and \t // if above condition is true store file to UploadFolder location \t if (Request.Files != null && Request.Files.Count > 0) \t { \t HttpPostedFile uploadedFile = Request.Files[0]; \t try \t { // Get the GUID \tstring guidResult = System.Guid.NewGuid().ToString(); \t \t// Remove the hyphens \tguidResult = guidResult.Replace("-", ""); \t \t// Make sure length is valid \t//if (length 9) \t // throw new ArgumentException("Length must be between 1 and 9"); \t \t// Return the first length bytes \tguidResult = guidResult.Substring(0, 4); string userid = ""; userid = Request.Form["file_userid"]; \t //Storing the file \t uploadedFile.SaveAs(UploadFolder + userid + "-" + guidResult + "-" + Path.GetFileName(uploadedFile.FileName)); \t // retrieve a file description \t string fDescription = ""; \t if (Request.Form["file_Description"] != null) \t { \t fDescription = Request.Form["file_Description"]; \t // some useful code, ex: storing description into DB "-" + guidResult + \t } \t Response.Write(String.Format("User number" + userid + " The file \"{0}\" has been uploaded Description: {1} ", Path.GetFileName(uploadedFile.FileName), fDescription)); \t // The following code is related to UploadDescription.html example only // \t if (Request.Form["menu"] != null) \t { \t Response.Write("Some menu: " + Request.Form["menu"].ToString() + ""); \t } \t if (Request.Form["author"] != null) \t { \t Response.Write("Author: " + Request.Form["author"].ToString()); \t } \t // The above code is related to UploadDescription.html example only // \t Response.Write(""); \t } \t catch(Exception ex) \t { \t Response.Write(String.Format("An error occured during file handling: {0}", ex.Message)); \t } \t } \t else \t { \t Response.Write("The file has not been sent."); \t } \t } What I need to do is insert userid, fdescription and the uploadedfile address into a mysql database, can you tell me what I need to do. Thank you, John.
VIEWS ON THIS POST

194

Posted on:

Wednesday 7th November 2012
View Replies!

Copy and Maintain Active Directory User details into mysql table using C#

For a given Domain name how can Iretrievethe AD User details including a Unique identifier so that any changes to the user details including the username can be updated using the unique Identifier. I can use System.DirectoryServices.DirectoryEntry to get the user details but not able to figure out how to work with the Unique Identifier to maintain the user detailsconsistently. Please provide me with some sample. Thank you
VIEWS ON THIS POST

284

Posted on:

Wednesday 7th November 2012
View Replies!

transfer excel to mysql

, May I ask your help on how to transfer excel file to mysql\t I found code in this forum that may help me on my task. Here are the code but still I'm experiencing errors, I may need your help to check and learn from your advice. I may need also to transfer this code to VB
VIEWS ON THIS POST

275

Posted on:

Wednesday 7th November 2012
View Replies!

mysql and visual foxpro

Visual foxpro is connecting to mysql bymysql connector and retrieve all the data from mysql table very fast , but i cannot add nor update any record to mysql table by sqlexec() , please help on this with a sample code . Tanks very much.
VIEWS ON THIS POST

219

Posted on:

Wednesday 7th November 2012
View Replies!

asp.net mysql odbc and membership roles

all, I am building this asp.net website with mysql and login controls. I used mysql connector/net and found that the hosting company doesn't support it and they recommended me to use odbc. Can someone point me to a good article or explain me here how to setup the login controls,membership, user roles with odbc connection Appreciate any help..
VIEWS ON THIS POST

392

Posted on:

Wednesday 7th November 2012
View Replies!

Deploying database to mysql5

, i am trying to delply a database using the publish feature, and the steps provided in this website http://weblogs.asp.net/scottgu/archive/2006/12/22/recipe-deploying-a-sql-database-to-a-remote-hosting-environment-part-1.aspx but i have found out that my hosting provider is using MySql5, and NOT MS Sql 2000/2003 or 2008. Is there a way i can use the publish feature to upload the database to the host with mysql5, and could anybody tell me the steps in doing so.
VIEWS ON THIS POST

174

Posted on:

Wednesday 7th November 2012
View Replies!

Inserting excel values into mysql database

if (arrDt[cntArr] == "INT" || arrDt[cntArr] == "TINYINT") \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t tempInt = Convert.ToInt16(dt.Tables[0].Rows[j][cntb]); \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t else if (arrDt[cntArr] == "VARCHAR" || arrDt[cntArr] == "TEXT") \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t tempString = dt.Tables[0].Rows[j][cntb].ToString(); \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t else \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t { \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t tempDate = Convert.ToDateTime(dt.Tables[0].Rows[j][cntb]); \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t } \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t cntArr++; \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t if (cntb != dt.Tables[0].Columns.Count - 1) \t\t\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t { \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t // val += "\'" + dt.Tables[0].Rows[j][cntb].ToString() + "\',"; \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t val += "\'" + tempInt + "," + tempString + ","+ tempDate +"\'";\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t } \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t else \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t { \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t //val += "\'" + dt.Tables[0].Rows[j][cntb].ToString() + "\',"; \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t val += "\'" + tempInt + ","+ tempString + ","+ tempDate +"\'"; \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t } \t\t\t\t\t\t\t\t\t\t\t\t\t } \t\t\t\t\t\t\t\t\t\t\t\t\t catch (Exception) { } \t\t\t\t\t\t\t\t\t\t\t } \t\t\t\t\t\t\t\t\t } \t\t\t\t \t\t\t\t\t\t\t\t\t val = val.Substring(0, val.Length - 1); \t\t\t\t\t\t\t\t\t strQuery = "INSERT INTO rardata ( " + dbField + ") Values(" + val + ")"; \t\t\t\t\t\t\t\t\t myCommand.CommandText = strQuery; \t\t\t\t\t\t\t\t\t myCommand.Parameters.Clear(); \t\t\t\t\t\t\t\t\t myCommand.Parameters.AddWithValue("dbField", val.Trim()); \t\t\t\t\t\t\t\t\t myCommand.ExecuteNonQuery(); I use the above code for changing the datatype of excel datatype but problem is that convered value is not assigned to the variable "val".When i concat these converted value in val then it first take by default it takes int and date value andin the second itration of the loop it takes value of string from variable"tempString".And i use simple queries .So what can i do please tell me as early as possible.Please help me
VIEWS ON THIS POST

202

Posted on:

Wednesday 7th November 2012
View Replies!

C# with mysql Database Bounding data problem

I have a query which return rows with specific fields \t SELECT First_Name, Midle_Name, Last_Name, Phone_home, Cell_home, ZipCode_Work, Phone_Work, Cell_Work FROM contact_info WHERE (Last_Name = @Last_Name) and here is my code to bind this query to datagridview control. protected void btnSearch_Click(object sender, EventArgs e) \t { \t DSSearchTableAdapters.contact_infoTableAdapter LastNameViewAdapter = new DSSearchTableAdapters.contact_infoTableAdapter(); \t DSSearch.contact_infoDataTable GetByLastName = LastNameViewAdapter.GetDataByLastNameView(txtSearch.Text); \t GridView1.DataSource = GetByLastName; \t GridView1.DataBind(); \t} the problem that the datagridview will show all the fields in the table not the field I selected. I'm suing VS 2008,asp.net with C# with mysql Database. Can you help I have a query which return rows with specific fields \t SELECT First_Name, Midle_Name, Last_Name, Phone_home, Cell_home, ZipCode_Work, Phone_Work, Cell_Work FROM contact_info WHERE (Last_Name = @Last_Name) and here is my code to bind this query to datagridview control. protected void btnSearch_Click(object sender, EventArgs e) \t { \t DSSearchTableAdapters.contact_infoTableAdapter LastNameViewAdapter = new DSSearchTableAdapters.contact_infoTableAdapter(); \t DSSearch.contact_infoDataTable GetByLastName = LastNameViewAdapter.GetDataByLastNameView(txtSearch.Text); \t GridView1.DataSource = GetByLastName; \t GridView1.DataBind(); \t} the problem that the datagridview will show all the fields in the table not the field I selected. I'm suing VS 2008,asp.net with C# with mysql Database. Can you help
VIEWS ON THIS POST

266

Posted on:

Wednesday 7th November 2012
View Replies!

Help me with statement of account in .net and mysql

people, I am developing web applications using .net and mysql as database. I have a two table one containing paymnet details and other goods details as follows table A with payment details Column Name CountNo PaymentDate Amount table B with Goods details CountNo GoodsValue Collectiondate Now I want an sql that will pick details from Table B first in that month and then gets details from Table A\t and subtract from goods value. In other words I want acculative sql or statement. How can I achieve this Please help
VIEWS ON THIS POST

208

Posted on:

Wednesday 7th November 2012
View Replies!

asp.net gridview using mysql, Will not update if PK column is not visible

I have a asp.net webform on it I have a sqldatasource\t and a gridview that has two columns a primary key and a description . ( I have more columns in my gridview, however in debugging this ,I have reduced this problem down to two columns, a primary key and another column in order to keep this problem simple) TheproblemIamhavingisIdonotwanttodisplaytheprimarykeysinceitisanautogeneratednumberandIdonotwanttheuserthinkingtheycanchangeit. However\twithinmygridviewInorderforthesavecommand\ttoworkImustaddthefollowing MySQLTable CREATETABLE`tblCouponCampaignMaster`( `CampaignID`int(10)unsignedNOTNULLauto_increment, `Description`varchar(145)defaultNULL, PRIMARYKEY\t(`CampaignID`), )ENGINE=InnoDBAUTO_INCREMENT=2048DEFAULTCHARSET=latin1ROW_FORMAT=FIXED; Form1.Aspx
VIEWS ON THIS POST

286

Posted on:

Wednesday 7th November 2012
View Replies!

couldn't connect to mysql server

i have phpmyadmin(by default mysql server) which i was earlier using in php. while connecting the database using asp.net connection string it's not working. connection.ConnectionString = "Data Source=mysql3.freehostia.com;" + "Initial Catalog=sansen1_polling;User ID=************;Password=******;"; conection state is always displaying false.what is wrong in the code. note already tried datasource=ip adress(ftp),1433; if u want i can give you the userid and password. thnks in advance sanjeev
VIEWS ON THIS POST

216

Posted on:

Wednesday 7th November 2012
View Replies!

Reading in CSV and comparing to mysql - faster way

I am reading in CSV file with 140000 records and comparing three columns to three columns in a mysql database (got the mysql class from the mysql website). If the record exists in the mysql database we are going to update some data, if not we are going to insert it. The mysql DB and CSV file are both local on the machine The basic code structure is... Open CSV file Open Database PREPARE the SQL query with parms Start Loop Read CSV File Fill in parms for mysql SELECT Execute select Check to see if anything came back - act appropriately (Not written yet : INSERT into DB, update DB) End Loop Close Database Close File --- This process is CRAWLING... as in I walked away from the computer for 20 minutes and only 1000 records had been parsed. This is just doing the looping and comparing - I have not even done the "Not written Yet" portion. Is there a faster way to do this I have no problem if 140000 records is going to take awhile. But this rate we are looking at 40-50 hours.
VIEWS ON THIS POST

193

Posted on:

Wednesday 7th November 2012
View Replies!

Want to upload an image file to mysql database

Hi all, i am designing n registration form for my site. previously i had some fields like email id, name and password and i had successfully connected to the database(mysql) and stored data into the table. for some reasons i also want to upload an image of the user. for that i found put that in mysql 'blob' data type is used. now please help me to upload a image file from file upload control to the database.. here is the code which i am using to connect to my database. please suggest the changes i hav to make. protected void Button1_Click(object sender, EventArgs e) \t { \t\t\t\t\t OdbcConnection conn = new OdbcConnection(); \t\t\t\t\t conn = new OdbcConnection("Driver={MySQL ODBC 5.1 Driver};Server=localhost;database=mysql;uid=dbuser;password=passwrd;"); \t\t\t\t\t OdbcDataReader myreader = null; \t\t\t\t\t conn.Open(); \t\t\t\t\t string query = "insert into Registration values('" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "')"; \t\t\t\t\t OdbcCommand comm = new OdbcCommand(query, conn); \t\t\t\t\t myreader = comm.ExecuteReader(); \t\t\t\t\t conn.Close(); } here textboxes contain email id, name and password entered by the user. please help.. , hi kaushal,
VIEWS ON THIS POST

211

Posted on:

Wednesday 7th November 2012
View Replies!

How to connect mysql from asp.net

HI, I have been using mssql, I want to switch to mysql. I need to know how to connect. Google gives you not much of a solution. questions are like can I connect using sqldatasource or odbc is the best solution. If ODBC is the best solution, then how to implement it. Pretty new to this idea. the help would be happily accepted.
VIEWS ON THIS POST

129

Posted on:

Wednesday 7th November 2012
View Replies!

mysql time zone

hi, \t i have changed the srver time zone to +05.30 but mysql timezone is not changing it's time zone according to the system time ...... so please help me to change the mysql timzone.............
VIEWS ON THIS POST

184

Posted on:

Wednesday 7th November 2012
View Replies!

Inserting images into mysql data using c#

hey dere, is dere any way that i can store or insert images into the mysql database and retrieve them successfully just like textual data. thnks in advance...
VIEWS ON THIS POST

221

Posted on:

Wednesday 7th November 2012
View Replies!

mysql and vb.net connection

, May I ask the following questions 1. How can I connect mysql to vb.net and showing it for example on a gridview 2. How can I use membership roles and username then linking it on my database\t Ex. If i have employees table it should have link the username and password on the aspdbnet table\t
VIEWS ON THIS POST

245

Posted on:

Wednesday 7th November 2012
View Replies!

output paramater in mysql

how to get output param value in .net code
VIEWS ON THIS POST

158

Posted on:

Wednesday 7th November 2012
View Replies!

c#+mysql unicode language insert

hi i am writing in c# and my db is mysql.... i am trying to insert unicode laguage ...for example russian ... and what i see in my db is '\t\t\t" i am using mysql connection my sql command and and my sql reader .... so the question is how can i insert unicode lanuage .....
VIEWS ON THIS POST

234

Posted on:

Wednesday 7th November 2012
View Replies!