Posts

Donate

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!!!

Webclient - The remote server returned an error: (403) Forbidden

Using downloadstring of webclient returns an error as stated by the post title. The solution was to add user agent header to the webclient headers. The value of user agent can be found in the mozilla firebug. Solution: string URL = string .Format(your_url); newWebClient.Headers.Add( "user-agent" , "Mozilla/5.0 (Windows NT 6.1; rv:2.0) Gecko/20100101 Firefox/4.0 "); string pageSource = newWebClient.DownloadString(URL); pageSource = System.Web.HttpUtility.HtmlDecode(pageSource);

How To Show External IP Address Using C# And WebClient

I experimented a snippet to get my ISP provided IP address using whatismyip. Using tutorials or code snippets from links, the web request just returned a 404 error. After reading the whatismyip API again,they have changed their automation URL. Below is the code snippet. //previous URL present on most tutorials which is not working //string whatIsMyIp = "http://www.whatismyip.com/automation/n09230945.asp"; //updated URL from whatismyip API string whatIsMyIp = "http://automation.whatismyip.com/n09230945.asp" ; WebClient wc = new WebClient(); UTF8Encoding utf8 = new UTF8Encoding(); string requestHtml = "" ; requestHtml = utf8.GetString(wc.DownloadData(whatIsMyIp));

Donate