From: "Saved by Windows Internet Explorer 7" Subject: ScottLaing.net Date: Tue, 16 Jun 2009 18:37:37 -0700 MIME-Version: 1.0 Content-Type: multipart/related; type="text/html"; boundary="----=_NextPart_000_0000_01C9EEB1.855FA5F0" X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6000.16669 This is a multi-part message in MIME format. ------=_NextPart_000_0000_01C9EEB1.855FA5F0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Location: http://web.archive.org/web/20041209190859/www.scottlaing.net/cgi-bin/showfile.pl?progfile=MyData.cs&project=xml&namespace=cs ScottLaing.net
--------------------------------------------------=
-------------------------------------------------------------------------=
-------------------------
Program Listing for:  MyData.cs
Project:  xml
Namespace:  cs
-------------------------------------------------------------------------=
-------------------------------------------------------------------------=
--
using System; using System.Data; using System.Windows.Forms; namespace HODecisionEntry { /// <summary> /// Summary description for = MyData. /// </summary> public class MyData { public MyData() { } // this is a straight forward = select wrapper // select method = behavior: // if no dataservice, = return null // if bad command syntax, = return null // otherwise return table public static DataTable Select( = string selectString)=20 { DataService ds1 =3D new DataService(); DataTable mytable = =3D null; if (ds1 =3D=3D = null)=20 { MessageBox.Show("Error: error = connecting to remote data service, are you online? Retry and notify = programmer."); return = null; } DataSet mydata =3D ds1.GetDataSetSelect( = selectString, "daffy" ); if (mydata =3D=3D = null)=20 { MessageBox.Show("Error: possibly bad = select string:\r" + selectString + "\rNo data = returned from select"); }=20 else { mytable =3D mydata.Tables[0]; } return mytable; } // this is a straight forward = select wrapper for select which returns a single value // method similar to = select method, but returns a string rather than datatable, if successful public static string = SelectSingleVal( string selectString)=20 { DataService ds1 =3D new DataService(); DataTable mytable = =3D null; string returnString = =3D null; if (ds1 =3D=3D = null)=20 { MessageBox.Show("Error: error = connecting to remote data service, are you online? Retry and notify = programmer."); return = null; } DataSet mydata =3D ds1.GetDataSetSelect( = selectString, "daffy" ); if (mydata =3D=3D = null)=20 { MessageBox.Show("Error: possibly bad = select string:\r" + selectString + "\rNo data = returned from select"); }=20 else { mytable =3D mydata.Tables[0]; // successful = select but returned no rows, return an empty string -- for now if = (mytable.Rows.Count =3D=3D 0)=20 { returnString =3D ""; }=20 // otherwise = process the returned row, from the first element only, get the value as = string else=20 { DataRow curRow =3D = mytable.Rows[0]; returnString =3D = curRow[0].ToString(); } } return = returnString; } // this is a straight forward = update, insert, delete command wrapper // if no dataservice, = returns -1 // if bad command syntax, = returns -1 // otherwise returns rows = affected (0-x) public static int Update(string updateString)=20 { DataService ds1 =3D new DataService(); if (ds1 =3D=3D = null)=20 { MessageBox.Show("Error: error = connecting to remote data service, are you online? Retry and notify = programmer."); return -1; } int rows =3D = ds1.ExecuteCommand(updateString, "scooby"); if (rows =3D=3D -1) = { MessageBox.Show("Some error = occurred, database not updated correctly."); MessageBox.Show( "Service reported = this error:\r" + ds1.GetLastError() ); ds1.ClearLastError(); } return rows; } } }


Back to = Portfolio

------=_NextPart_000_0000_01C9EEB1.855FA5F0 Content-Type: text/css; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Location: http://web.archive.org/web/20041209190859/http://www.scottlaing.net/code.css BODY { FONT-SIZE: 11px; COLOR: #00cc00; FONT-FAMILY: sans-serif; = BACKGROUND-COLOR: #000000 } PRE { FONT-WEIGHT: bold; FONT-SIZE: 11px; COLOR: #00cc00; FONT-FAMILY: Arial; = BACKGROUND-COLOR: #000000 } .b { WIDTH: 10px; HEIGHT: 10px; BACKGROUND-COLOR: #13273c } A { COLOR: #cccccc } SELECT { FONT-SIZE: 11px; COLOR: #000000; FONT-FAMILY: Tahoma, Arial, = sans-serif; BACKGROUND-COLOR: #999999 } INPUT { FONT-SIZE: 11px; COLOR: #000000; FONT-FAMILY: Tahoma, Arial, = sans-serif; BACKGROUND-COLOR: #999999 } TEXTAREA { COLOR: #000000; FONT-FAMILY: Tahoma, Arial, sans-serif; = BACKGROUND-COLOR: #999999 } P { FONT-WEIGHT: bold; FONT-SIZE: 10px; COLOR: #999999; FONT-FAMILY: = 'verdana','Arial','helvetica'; BACKGROUND-COLOR: #000000 } LI { FONT-WEIGHT: bold; FONT-SIZE: 10px; COLOR: #999999; FONT-FAMILY: = 'verdana','Arial','helvetica'; BACKGROUND-COLOR: #000000 } TD { FONT-SIZE: 11px; FONT-FAMILY: Tahoma, Arial, sans-serif } B { FONT-SIZE: 12px; COLOR: #4682b4 } .a { BACKGROUND-COLOR: #183049 } #menu { FONT-SIZE: 11px; BACKGROUND: #ffffff; FONT-FAMILY: 'Arial', Times; = TEXT-DECORATION: none } #menuh { BORDER-RIGHT: 1px outset; BORDER-TOP: 1px outset; FONT-WEIGHT: bold; = FONT-SIZE: 12px; BACKGROUND: #395f8c; BORDER-LEFT: 1px outset; COLOR: = white; BORDER-BOTTOM: 1px outset; FONT-FAMILY: 'Arial', Times; = TEXT-DECORATION: none } menuh { BORDER-RIGHT: 1px outset; BORDER-TOP: 1px outset; FONT-WEIGHT: bold; = FONT-SIZE: 12px; BACKGROUND: #395f8c; BORDER-LEFT: 1px outset; COLOR: = white; BORDER-BOTTOM: 1px outset; FONT-FAMILY: 'Arial', Times; = TEXT-DECORATION: none } drakis1 { WIDTH: 10px; COLOR: #ffffff; FONT-FAMILY: Tahoma, Arial, sans-serif; = HEIGHT: 10px } #pagetitle { FONT-WEIGHT: bold; FONT-SIZE: 22px; FONT-FAMILY: 'Charter BT' } INPUT { FONT-SIZE: 10px; FONT-FAMILY: "Arial" } SELECT { FONT-SIZE: 10px; FONT-FAMILY: "Arial" } UL { FONT-SIZE: 12px; FONT-FAMILY: verdana } .rr { FONT-WEIGHT: bold; FONT-SIZE: 22px; COLOR: #990000; FONT-FAMILY: "Old = English Text MT", "Times New Roman", "Times" } #rr { FONT-WEIGHT: bold; FONT-SIZE: 22px; COLOR: #990000; FONT-FAMILY: "Old = English Text MT", "Times New Roman", "Times" } .fs14 { FONT-WEIGHT: 500; FONT-SIZE: 12px } #lr { BACKGROUND: url(http://www.sboe.state.az.us/bgl.gif) #b1a67e } .lr { BACKGROUND: url(http://www.sboe.state.az.us/bgl.gif) #b1a67e } #dr { BACKGROUND: url(http://www.sboe.state.az.us/bg.gif) #b1a67e } .dr { BACKGROUND: url(http://www.sboe.state.az.us/bg.gif) #b1a67e } #headerrow { FONT-WEIGHT: bold; FONT-SIZE: 12px; BACKGROUND: #b1a67e; MARGIN: 0px; = COLOR: black } #bigrow { FONT-WEIGHT: bold; FONT-SIZE: 18px; COLOR: black } #red { FONT-SIZE: 10px; COLOR: darkred; TEXT-DECORATION: none } #notbold { FONT-WEIGHT: normal } #fs8 { FONT-SIZE: 10px } #Administrator { FONT-WEIGHT: bold; COLOR: darkred } #Guru { FONT-WEIGHT: bold; COLOR: red } #Sage { FONT-WEIGHT: bold; COLOR: darkgreen } #Scholar { FONT-WEIGHT: bold; COLOR: darkblue } #User { FONT-WEIGHT: bold; COLOR: black } #m2 { =09 } ------=_NextPart_000_0000_01C9EEB1.855FA5F0--