I was looking for how I can hide all buttons in listview, by calling a function, without needing to populate data to the listview again (not using the ItemDataBound event).
Here's the solution I've found, it's so simple!
private void ShowButtons(bool show)
{
foreach (ListViewItem item in lvwQuotations.Items)
{
((Button)item.FindControl("btnView")).Visible = show;
}
}
Wednesday, January 30, 2013
Thursday, January 10, 2013
First calling SELECT statement in mySql
It may be simple, but I did not know the syntax of doing so, hence I have also spent some time to get this done. Well, finally it works!
ArrayList parameters = new ArrayList(); parameters.Add(new OdbcParameter("?Email", email)); parameters.Add(new OdbcParameter("?Password", password)); string sql = "SELECT * FROM Members WHERE Email=? and Password=?";
First attempt to connect to mySql database with ASP.NET
After a few day researching and trying, finally I've successfully connect to mySql database with ASP.NET.
I really gotta write down how to do so, otherwise I'll surely forget the steps even in near future.
I have WAMP server installed, (learn how to set up WAMP server here) at first I was working with the mysql already installed with WAMP.
I tried to connect to the database, but failed to do so, I always got "ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified" when I was trying to call Connection.Open().
I have been searching around, but couldn't find the solution yet, and I suspected it was something wrong with my mysql setting, then I decided to install mysql separately.
These are how it helped me to work:
1. First, I downloaded MySQL Community Server 5.5.29, the latest version, zip edition, but I couldn't understand how it worked.
Then I clicked on "Looking for previous GA versions?", downloaded & installed MySQL Community Server 5.1.67.
I just revisited the page now, and now only I found there is a recommended download - MySQL Installer 5.5 for Windows (All MySQL Products - including MySQL server, connectors, Workbench, etc), perhaps I should get this.
2. Then, I got the MySQL Workbench, which is a GUI tool, to help me easily work with the database.
After setting all these, I still get the "Data source name not found" error.
3.Finally, I found this - Setting up MySQL for use through ODBC. This really saved me! And I managed to connect to mysql database successfully!
This is the connection string I use:
I really gotta write down how to do so, otherwise I'll surely forget the steps even in near future.
I have WAMP server installed, (learn how to set up WAMP server here) at first I was working with the mysql already installed with WAMP.
I tried to connect to the database, but failed to do so, I always got "ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified" when I was trying to call Connection.Open().
I have been searching around, but couldn't find the solution yet, and I suspected it was something wrong with my mysql setting, then I decided to install mysql separately.
These are how it helped me to work:
1. First, I downloaded MySQL Community Server 5.5.29, the latest version, zip edition, but I couldn't understand how it worked.
Then I clicked on "Looking for previous GA versions?", downloaded & installed MySQL Community Server 5.1.67.
I just revisited the page now, and now only I found there is a recommended download - MySQL Installer 5.5 for Windows (All MySQL Products - including MySQL server, connectors, Workbench, etc), perhaps I should get this.
2. Then, I got the MySQL Workbench, which is a GUI tool, to help me easily work with the database.
After setting all these, I still get the "Data source name not found" error.
3.Finally, I found this - Setting up MySQL for use through ODBC. This really saved me! And I managed to connect to mysql database successfully!
This is the connection string I use:
DRIVER={MySQL ODBC 5.1 Driver};SERVER=localhost;PORT=3306;DATABASE=test;UID=root;PWD=;
Subscribe to:
Posts (Atom)