Posts

Showing posts from July, 2011

Donate

MySQL Date Range Query (Using Logical Operators)

Here's another version using logical operators in MySQL. 1: select date_format(date_purchased, '%m/%d/%Y' ) as dates, 2: url from dbcommerce.tblproducts 3: where date_format(date_purchased, '%m/%d/%Y' ) >= '04/30/2011' 4: and date_format(date_purchased, '%m/%d/%Y' ) <= '05/30/2011' 5: order by date_purchased asc ;

MySQL Date Range Query Example

Here is an example to query MySQL Date Range given the date field is of type TimeStamp. The date_format() will remove the time part in comparing. select date_format(date_purchased, '%m/%d/%Y' ) as dates, url from dbCommerce.tblproducts where date_format(date_purchased, '%m/%d/%Y' ) between '04/30/2011' and '05/30/2011' order by date_purchased asc ;

Unable To Convert MySQL DateTime Value To System.DateTime In C# Or ASP.NET

Solution: Add Allow Zero to your Web.Config or App.Config <add key= "connectionString" value= "Database=your_db ;Data Source=localhost;User Id=root; Password=password;Allow Zero Datetime=True;" /> Cheers!

Newline For C# Equivalent With Environment.Newline

txtOutput.Text = "Select All Nodes" + "\r\n" ; //or txtOutput.Text = "Select All Nodes" + Environment.Newline;

Setup SQL Developer To Connect To A MySQL Database

1. Download sql developer from oracle site 2. Copy sql developer to drive C:\ 3. Copy msvcr71.dll to %WinDir%\System32 [reference: http://gisbiz.com/2011/05/fixing-the-sql-developer-msvcr71-dll-error/] msvcr71.dll is located in: [sqldeveloper\jdk\jre\bin\msvcr71.dll] 4. Download mysql-connector-java-5.0.8-bin.jar zip file from this site: Download MySQL connector Java 5. Extract mysql-connector-java-5.0.8-bin.jar in sql developer lib folder: C:\Users\gnesguerra\Downloads\sqldeveloper-3.0.04.34\sqldeveloper\lib 6. Setup sql developer to connect to mysql database using the tutorial from this site: Starting from Setting it Up Paragraph: Configuring SQL Developer for MySQL    6.1 Click Choose Database button below Port label.    6.2 Beside the Choose Database button, select the database you want to connect to from the dropdown control.    6.3 Zero Date Handling should be set to null    6.4 Click Connect 7. (Increase Operation Timeout)    7

Retrieve Record Counts For All Tables In MySQL DB

Reference: Get Record Counts for All Tables in MySQL

Using Proxy With WebClient In VB.NET

Here is a snippet to use WebProxy. This is useful for scraping or other webrequest activities. Dim webclient As New System.Net.WebClient Try 'true for bypassOnLocal webclient .Proxy = New System.Net.WebProxy( "180.95.129.232:80" , true ) wc.OpenRead( "http://yoursite.com" ) lblStatus.Text = "ok" Catch lblStatus.Text = "error proxy" End Try

Format Query Result By Count() With Comma Using Format() In MySQL Database

I played around with MySQL count() statement. I found it annoying that the count() will simply return whole numbers. Example: the total record of a table is 32,272. In MySQL SQL, this will simply return 32272. Below are two sql scripts. The first one returns whole number,while the second query returns comma separated number. ENJOY!!!! select count (*) as num_records_notformatted from mytable where name like '%j%' ; Solution: select format( count (id),0) as num_records_formatted from mytable where name like '%j%' ;

How To Set The Scrollbars In WPF Textbox

You can set the scrollbars in a WPF TextBox control using it's properties: HorizontalScrollBarVisibility= "Visible" VerticalScrollBarVisibility= "Auto" or using the ScrollView class: ScrollViewer.HorizontalScrollBarVisibility= "Auto" ScrollViewer.VerticalScrollBarVisibility= "Auto"

Control.InvokeRequired Not Found Or Missing In WPF

Hello, I was doing a little WPF threading recently which involved changing my codes from Winforms to WPF. Surprisingly, I was not able to find the code below in the intellisense: Control.Dispatcher.CheckAccess() After googling, I found this link: Why is Dispatcher.CheckAccess() hidden from intellisense? I wonder why Microsoft hid some features on intellisense. Or it could be a bug. Regards!!!

Donate