tirsdag 9. juni 2009

#include
using namespace std;

int main()
{
const float PI = 3.1415926;
int r = 0; float cir = 0;
cout << "Skriv radius: ";
cin >> r;
cir = 2 * r * PI;
cout <<>
system("pause");
return 0;
}

c++

#include

using namespace std;
int main(){ int x= 10; int y= 3;

string message = "Data type table";

string apndMessage = "welcome to the "; string totalMessage = "";

totalMessage = apndMessage + message;

cout <<>

/*cout << x = " << x << " y = " << y << endl; cout << " y = " << x+y << endl; cout << " y = " << x-y << endl; cout << " y = " << x*y << endl; cout << " y =" ">

system ("pause");

return 0; }

torsdag 4. juni 2009

C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin


gacutil.exe

I've installed a dll in the GAC (gacutil /i Employee.dll
gacutil -I MySql.Data.dll


MySql.Data.Dll

tirsdag 2. juni 2009

Stored Procedures

http://www.csharp-station.com/Tutorials/AdoDotNet/Lesson07.aspx

http://www.c-sharpcorner.com/UploadFile/pk_khuman/ManagedStoredProceduresUsingCSharp02182007232059PM/ManagedStoredProceduresUsingCSharp.aspx


http://www.programmingado.net/a-133/Fetching-MySQL-data-through-stored-procedures.aspx

DELIMITER $$
DROP PROCEDURE IF EXISTS `db_test`.`City_GetByCountry`$$
CREATE PROCEDURE `db_test`.`City_GetByCountry` (p_in_country_id int)
BEGIN
select * from city where country_id=p_in_country_id;
END$$
DELIMITER ;

public DataTable GetDataSP_MySQL(long in_country_id)
{
MySql.Data.MySqlClient.MySqlConnection oConn = new MySql.Data.MySqlClient.MySqlConnection();
oConn.ConnectionString = "Database=sakila;Data Source=192.168.10.4;User id=stefan;Password=pekka"; oConn.Open();
DataSet oDataSet = new System.Data.DataSet("tab1");
//Get data
MySql.Data.MySqlClient.MySqlCommand command = new MySql.Data.MySqlClient.MySqlCommand("City_GetByCountry", oConn);
command.Parameters.Add(new MySql.Data.MySqlClient.MySqlParameter("?p_in_country_id", DbType.Int32));
// Now, add a value to it and later execute the command as usual.
command.Parameters[0].Value = in_country_id;
command.CommandType = CommandType.StoredProcedure;
MySql.Data.MySqlClient.MySqlDataAdapter oAdapter =
new MySql.Data.MySqlClient.MySqlDataAdapter(command);
oAdapter.Fill(oDataSet, "tab1");
DataTable dt = oDataSet.Tables["tab1"];
oConn.Close();

return dt;
}


http://dev.mysql.com/doc/refman/5.0/en/create-procedure.html

mysql> delimiter //
mysql> CREATE PROCEDURE simpleproc (OUT param1 INT)
-> BEGIN
-> SELECT COUNT(*) INTO param1 FROM t;
-> END//
Query OK, 0 rows affected (0.00 sec)
mysql> delimiter ;
mysql> CALL simpleproc(@a);
Query OK, 0 rows affected (0.00 sec)
mysql> SELECT @a;
+------+
@a
+------+
3
+------+
1 row in set (0.00 sec)

mandag 1. juni 2009

Private Class properties

FORM1

namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e)
{
HappyBirthday HB;
HB = new HappyBirthday();
string returB;
HB.MyProperty = "glenn";
returB = HB.MyProperty;
MessageBox.Show(returB);
}
}
}

Class

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace WindowsFormsApplication1
{
class HappyBirthday
{
private string getMessage(string givenName)
{
return "happy Birthday" + givenName;
}
private string birthdayMessage;

public string MyProperty
{
get { return birthdayMessage; }
set { birthdayMessage = getMessage(value); }
}
}
}

call metode from class

FORM1

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
HappyBirthday birthdayMessage;
birthdayMessage = new HappyBirthday();
MessageBox.Show(birthdayMessage.getMessage());
}
}
}

CLASS

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace WindowsFormsApplication1
{
class HappyBirthday
{
public string getMessage()
{
return "happy Birthday";
}
}
}

Good turtorial

http://www.homeandlearn.co.uk/csharp/csharp.html http://www.homeandlearn.co.uk/csharp/csharp.htmlhttp://www.homeandlearn.co.uk/csharp/csharp.htmlhttp://www.homeandlearn.co.uk/csharp/csharp.htmlhttp://www.homeandlearn.co.uk/csharp/csharp.htmlhttp://www.homeandlearn.co.uk/csharp/csharp.html
http://www.homeandlearn.co.uk/csharp/csharp.html
http://www.homeandlearn.co.uk/csharp/csharp.html
http://www.homeandlearn.co.uk/csharp/csharp.html

http://www.homeandlearn.co.uk/csharp/csharp.html
http://www.homeandlearn.co.uk/csharp/csharp.html
http://www.homeandlearn.co.uk/csharp/csharp.html

http://www.homeandlearn.co.uk/csharp/csharp.htmlhttp://www.homeandlearn.co.uk/csharp/csharp.htmlhttp://www.homeandlearn.co.uk/csharp/csharp.html
http://www.homeandlearn.co.uk/csharp/csharp.html
http://www.homeandlearn.co.uk/csharp/csharp.html
http://www.homeandlearn.co.uk/csharp/csharp.html
http://www.homeandlearn.co.uk/csharp/csharp.html
http://www.homeandlearn.co.uk/csharp/csharp.html

function test

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace function_test
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public void bluX()
{
if (this.BackColor == Color.Blue)
{
this.BackColor = Color.Black;
}
else
{
this.BackColor = Color.Blue;
}
}
private void button1_Click(object sender, EventArgs e)
{
bluX();
}

}
}