1

I have a claims based FBA sharepoint website in sharepoint 2010 where a users data is stored in MYSQL like all there usersid's and password . Now i want to connect some visual webpart controls to MYSQL , So where and how should i define the connection of that visual webpart with MY SQL ?

2 Answers 2

1

I think that will depend on your type of Visual Web Part. The solution for 2010 created Sand boxed Visual webparts and if that is case you won't be able to connect directly as code policy won't allow that. You will need to look at:

  • Surface the data thru BCS and then use your web part to connect to BCS to display the data
  • Creating a trusted proxy you can call to make the connection
  • Or using a farm solution or the "Older" Visual web part method that was used with 2007 (Example: https://smartpart.codeplex.com/ )
1

You can define your connection string in the web.config file. In the appSettings of your web.config file add a new key like

<add key="mysqlConnStr" value="path of your mysql serve"/>

No get it in your Web Part like following.

private string mysqlConnStr = WebConfigurationManager.AppSettings["mysqlConnStr "];

Then follow this article to read/write data using C#.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.