Archive
casting a OleDbSchemaGuid to a System.GUID
A nice trick I just discovered whilst writing the OleDbWebService (see network.programming-in.net for details) was that I wanted a function that would encapsulate the GetOleDbSchemaTable function, to which one of the parameters is a OleDbSchemaGuid enumeration. Even though the enumeration’s underlying type is a System.GUID, you can’t make a explicit cast. However – you can cast it to an object and back to a GUID thus !
System.Guid schemaType = (System.Guid)((object)schemaAspect);
Unable to find dependency ‘mscorlib’
Getting an unusual warning when building a .NET (in VS .NET 2002) application;
Unable to find dependency ‘mscorlib’ (Signature=’B77A5C561934E089′ Version=’1.0.5000.0′) of assembly ‘System.dll’
Unable to find dependency ‘mscorlib’ (Signature=’B77A5C561934E089′ Version=’1.0.5000.0′) of assembly ‘System.Xml.dll’
Anybody any ideas?
SendSMSWorld
I spotted this nice webservice http://www.webservicex.net/sendsmsworld.asmx
Apparently, it works on several international mobile phone networks. Not in Ireland (where I’m based) – Has anybody any experience with this? does it actually work?
—————————–
<snip>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<BODY>
Austria -</b><font face=Arial size=-1> Mobilkom<b>
Quicklink Unternehmensgruppe Presseaussendungen Aktuelle Jobangebote Mobilfunk & Umwelt Produkte & Services Rufnummernmitnahme Ihr direkter Zugang zu den meistgefragten Themen 07.02.05 mobilkom austria sorgt mit UMTS Plus® Angebot für Innovationsschub in Österreich Zum Umstand, dass tele.ring und T-Mobile mobilkom austria wegen ihres UMTS Plus® Angebotes klagen, gibt das Unternehmen folgende Klarstellung
02.02.05 Handy-Navigationssystem A1 NAVI mit neuem All-Inclusive Preismodell noch attraktiver Zusätzliche Funktionen im Web erleichtern die Routenplanung vorab – Neue Endgeräte mit A1 NAVI-Unterstützung
28.01.05 mobilkom austria ernennt Irina Hönel zur neuen Vorstandsvorsitzenden der A1 BANK AG Die Salzburgerin, die bereits mehrjährige Erfahrung in der Banken-Branche hat, bildet gemeinsam mit Mag. Thomas Capka den Vorstand der A1 BANK
Das Unternehmen mobilkom austria verbindet fast fünf Millionen Menschen in vier Ländern. Wir tragen also große Verantwortung. Mehr denn je versuchen wir, die gesellschaftlichen Trends zu erforschen. Unsere Innovationen sollen auch in Zukunft den Bedürfnissen der Menschen entsprechen – praktische Lösungen, die Arbeit ersparen und etwas von der Zeit zurückgeben, die uns das moderne Leben abverlangt. Die Zukunft ist mobil. Bleiben Sie mit uns dran.
<br> Bulgaria – </b>Mobiltel <b><br>Croatia -</b> Cronet <b><br>Germany -</b> E-Plus,Mannesman D2 <b><br>Israel – </b>Pelephone <b><br>Lithuania -</b> Omnitel <b><br>Maldives – </b>Dhiraagu <b><br>Norway – </b>NetCom,TeleNor <b><br> Switzerland – </b>Bluewin <b><br>USA – </b>Ameritech Cellular services ,Cellular One, Cingular <b><br>Brazil – </b>ATL express,Telemig Cellular <b><br>Canada -</b> Bell Mobility, Clearnet, Rogers AT&T Wireless ,Telus <b><br>France – </b>Itineris <b><br>India – </b>Essar Cell Phone,RPG Cellular <b><br>Japan – </b>NTT Docomo <b> <br>Malaysia – </b>Celcom <b><br>New Zealand – </b>Messagetrack <b><br>Spain -</b> MoviStar <b><br>Ukraine – </b>Golden Telecom, UMC <b><br>USA – </b>Comcast Cellular Communications,Voicestream Wireless Corp. </td></tr> </table>
</BODY>
</HTML>
Configuration files for windows forms
I often found that it was time consuming, when putting together a "Throw-away" application, that so much UI plumbing was required – with check boxes, text boxes, listboxes etc. were required to allow some sort of user configurability. Of course, a UI is required for a public App., but for personal use, I thought it might be handier to use an XML file, slapped into the same Bin folder as the executing assembley.
So for instance, with an XML file like
<root>
<websites>
<website/>…
</websites>
<files>
<file/>…
</files>
</root>
I put this function in to rhe main function
public void readConfigXml()
{
string path = System.IO.Path.GetDirectoryName(
System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase );
path = path.Substring(6);
FileStream xmlFile =
new FileStream(path + "\config.xml",FileMode.Open);
string xmlContent = new StreamReader(xmlFile).ReadToEnd();
xmlFile.Close();
XmlDocument doc = new XmlDocument();
doc = new XmlDocument();
doc.LoadXml(xmlContent);
XmlElement root = doc.DocumentElement;
websites = root.ChildNodes[0].ChildNodes;
files = root.ChildNodes[1].ChildNodes;
}
Problem with SQL Wrapper
As I mentioned earlier, I was looking for a way to add SQL caching capabilities easily into .NET without upsetting, too much code – So I started off with a simple Query/Analyser program –
private void button1_Click(object sender, System.EventArgs e)
{
DataSet resultSet = ExecuteDataSet(this.tbSql.Text,this.tbConnectionString.Text);
this.dataGrid.DataSource = new DataView(resultSet.Tables["sql"]);
}
public DataSet ExecuteDataSet(string sql,string connectionString)
{
DataSet ds = new DataSet();
SqlConnection DSN = new SqlConnection(connectionString);
DSN.Open();
SqlCommand Database = new SqlCommand(sql,DSN);
SqlDataAdapter Adapter = new SqlDataAdapter(Database);
Adapter.Fill(ds,"sql");
DSN.Close();
return ds;
}
Then. tried to create a namespace called CachedSqlClient, which would take all the classes from SqlClient, but modify and extend them to support caching, my first attempt being:
using
System;
using System.Data;
using
System.Data.SqlClient;
namespace CachedSqlClient
{
public class SqlConnecion : System.Data.SqlClient.SqlConnection
{
}
}
But I got the error
C:Documents and SettingsadminMy DocumentsVisual Studio ProjectsBootstrapSQLCacheCachedSqlClientClass1.cs(10): ‘CachedSqlClient.SqlConnecion’ : cannot inherit from sealed class ‘System.Data.SqlClient.SqlConnection’
About this blog
This blog, is an experiment, and a list of random thoughts and ideas that come into my head whilst developing my main site http://network.programming-in.net
I was intending to write an article on one of the following
- Windows Firewall API
- DirectPlay API
- HttpListener
Or perhaps, a SQL Caching utility (where common, lengthy SQL queries & responses would be cached to disk, for a pre-determined length of time).