- crud_music.zip
- CRUD_Music
- de
- Npgsql.resources.dll
- es
- Npgsql.resources.dll
- fi
- Npgsql.resources.dll
- fr
- Npgsql.resources.dll
- ja
- Npgsql.resources.dll
- Mono.Security.dll
- Music.ex_
- Npgsql.dll
- zh-CN
- Npgsql.resources.dll
- crud_musicsrc.zip
- CRUD_MusicSRC
|
/*
* Created by SharpDevelop.
* User: wancho
* Date: 20/10/2009
* Time: 14:37
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using Npgsql;
namespace Music
{
/// <summary>
/// Description of MainForm.
/// </summary>
public partial class MainForm : Form
{
public MainForm()
{
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
//
// TODO: Add constructor code after the InitializeComponent() call.
//
}
void MainFormLoad(object sender, EventArgs e)
{
// We fill our DataSet and we set the table in the Dataset as "artists"
adapter.Fill(mainDS,"artists");
// We must set the DataMember property in the BindingSource
// it cannot be set at the designer since our DataSet isn't populated
bsource.DataMember="artists";
// We add the DataBinding to the TextBox linked to the "Text" property
// and linked to the BindingSource
t_artistID.DataBindings.Add("Text",bsource,"artistid");
t_name.DataBindings.Add("Text",bsource,"name");
// Now we must set the Relation between the parameters and the fields
// in the Database
cmdInsert.Parameters.Add(new NpgsqlParameter("p_artistID",NpgsqlTypes.NpgsqlDbType.Integer,0,"artistid"));
cmdInsert.Parameters.Add(new NpgsqlParameter("p_name",NpgsqlTypes.NpgsqlDbType.Varchar,0,"name"));
cmdDelete.Parameters.Add(new NpgsqlParameter("p_artistID",NpgsqlTypes.NpgsqlDbType.Integer,0,"artistid"));
cmdUpdate.Parameters.Add(new NpgsqlParameter("p_artistID",NpgsqlTypes.NpgsqlDbType.Integer,0,"artistid"));
cmdUpdate.Parameters.Add(new NpgsqlParameter("p_name",NpgsqlTypes.NpgsqlDbType.Varchar,0,"name"));
}
void ToolStripButton1Click(object sender, EventArgs e)
{
// We call this method to officialy end the editing of the Bindingsource
bsource.EndEdit();
// Now we will try to update our table
try {
adapter.Update(mainDS.Tables["artists"]);
}
// We must catch the Exception, because the user may cause a SQL exception
catch (Exception e_exception)
{
MessageBox.Show("Error.... "+e_exception.Message,"Error tryng to commit");
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.