Evo mog koda, pa vi vididte gde sta nestima:
Code:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Diagnostics;
namespace CD_Katalog
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Forma1 : System.Windows.Forms.Form
{
private System.Windows.Forms.MainMenu mainMenu1;
private System.Windows.Forms.MenuItem menuItem1;
private System.Windows.Forms.MenuItem menuItem2;
private System.Windows.Forms.MenuItem menuItem9;
private System.Windows.Forms.MenuItem menuItem10;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.StatusBar statusBar1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.DataGrid dataGrid1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.GroupBox groupBox4;
private System.Data.OleDb.OleDbCommand oleDbSelectCommand1;
private System.Data.OleDb.OleDbCommand oleDbInsertCommand1;
private System.Data.OleDb.OleDbCommand oleDbUpdateCommand1;
private System.Data.OleDb.OleDbCommand oleDbDeleteCommand1;
private System.Data.OleDb.OleDbConnection oleDbConnection1;
private System.Data.OleDb.OleDbDataAdapter oleDbDataAdapter1;
public CD_Katalog.DataSet1 dataSet11;
private System.Data.OleDb.OleDbCommand oleDbSelectCommand2;
private System.Data.OleDb.OleDbCommand oleDbInsertCommand2;
private System.Data.OleDb.OleDbCommand oleDbUpdateCommand2;
private System.Data.OleDb.OleDbCommand oleDbDeleteCommand2;
private System.Data.OleDb.OleDbDataAdapter oleDbDataAdapter2;
private System.Windows.Forms.Button osveziBbutton;
private System.Windows.Forms.DataGridTableStyle dataGridTableStyle1;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn1;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn2;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn3;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn4;
private System.Windows.Forms.ToolTip toolTip1;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.MenuItem menuItem3;
private System.Windows.Forms.CheckBox checkBox1;
private System.Windows.Forms.Label label3;
private System.ComponentModel.IContainer components;
public Forma1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Forma1));
this.mainMenu1 = new System.Windows.Forms.MainMenu();
this.menuItem1 = new System.Windows.Forms.MenuItem();
this.menuItem2 = new System.Windows.Forms.MenuItem();
this.menuItem3 = new System.Windows.Forms.MenuItem();
this.menuItem9 = new System.Windows.Forms.MenuItem();
this.menuItem10 = new System.Windows.Forms.MenuItem();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.label2 = new System.Windows.Forms.Label();
this.textBox3 = new System.Windows.Forms.TextBox();
this.dataGrid1 = new System.Windows.Forms.DataGrid();
this.dataSet11 = new CD_Katalog.DataSet1();
this.dataGridTableStyle1 = new System.Windows.Forms.DataGridTableStyle();
this.dataGridTextBoxColumn1 = new System.Windows.Forms.DataGridTextBoxColumn();
this.dataGridTextBoxColumn2 = new System.Windows.Forms.DataGridTextBoxColumn();
this.dataGridTextBoxColumn3 = new System.Windows.Forms.DataGridTextBoxColumn();
this.dataGridTextBoxColumn4 = new System.Windows.Forms.DataGridTextBoxColumn();
this.statusBar1 = new System.Windows.Forms.StatusBar();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.label3 = new System.Windows.Forms.Label();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.button4 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.button2 = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.osveziBbutton = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.oleDbSelectCommand1 = new System.Data.OleDb.OleDbCommand();
this.oleDbConnection1 = new System.Data.OleDb.OleDbConnection();
this.oleDbInsertCommand1 = new System.Data.OleDb.OleDbCommand();
this.oleDbUpdateCommand1 = new System.Data.OleDb.OleDbCommand();
this.oleDbDeleteCommand1 = new System.Data.OleDb.OleDbCommand();
this.oleDbDataAdapter1 = new System.Data.OleDb.OleDbDataAdapter();
this.oleDbSelectCommand2 = new System.Data.OleDb.OleDbCommand();
this.oleDbInsertCommand2 = new System.Data.OleDb.OleDbCommand();
this.oleDbUpdateCommand2 = new System.Data.OleDb.OleDbCommand();
this.oleDbDeleteCommand2 = new System.Data.OleDb.OleDbCommand();
this.oleDbDataAdapter2 = new System.Data.OleDb.OleDbDataAdapter();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dataSet11)).BeginInit();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
this.groupBox4.SuspendLayout();
this.SuspendLayout();
//
// mainMenu1
//
this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem1,
this.menuItem9});
//
// menuItem1
//
this.menuItem1.Index = 0;
this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem2,
this.menuItem3});
this.menuItem1.Text = "Ba&za Podataka";
//
// menuItem2
//
this.menuItem2.Index = 0;
this.menuItem2.Shortcut = System.Windows.Forms.Shortcut.AltF10;
this.menuItem2.Text = "Snimi &bazu podataka";
//
// menuItem3
//
this.menuItem3.Index = 1;
this.menuItem3.Shortcut = System.Windows.Forms.Shortcut.AltF4;
this.menuItem3.Text = "I&zlaz";
this.menuItem3.Click += new System.EventHandler(this.menuItem3_Click_1);
//
// menuItem9
//
this.menuItem9.Index = 1;
this.menuItem9.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem10});
this.menuItem9.Text = "&O programu";
//
// menuItem10
//
this.menuItem10.Index = 0;
this.menuItem10.Shortcut = System.Windows.Forms.Shortcut.F1;
this.menuItem10.Text = "O &Cd Katalogu...";
this.menuItem10.Click += new System.EventHandler(this.menuItem10_Click);
//
// groupBox1
//
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.textBox3);
this.groupBox1.Controls.Add(this.dataGrid1);
this.groupBox1.Location = new System.Drawing.Point(8, 8);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(472, 320);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Diskovi";
//
// label2
//
this.label2.Location = new System.Drawing.Point(64, 16);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(56, 23);
this.label2.TabIndex = 2;
this.label2.Text = "Traži disk:";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// textBox3
//
this.textBox3.Location = new System.Drawing.Point(120, 16);
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(224, 20);
this.textBox3.TabIndex = 1;
this.textBox3.Text = "";
this.textBox3.TextChanged += new System.EventHandler(this.textBox3_TextChanged);
//
// dataGrid1
//
this.dataGrid1.BackgroundColor = System.Drawing.Color.Lavender;
this.dataGrid1.DataMember = "Diskovi";
this.dataGrid1.DataSource = this.dataSet11;
this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dataGrid1.Location = new System.Drawing.Point(8, 48);
this.dataGrid1.Name = "dataGrid1";
this.dataGrid1.Size = new System.Drawing.Size(456, 264);
this.dataGrid1.TabIndex = 0;
this.dataGrid1.TableStyles.AddRange(new System.Windows.Forms.DataGridTableStyle[] {
this.dataGridTableStyle1});
//
// dataSet11
//
this.dataSet11.DataSetName = "DataSet1";
this.dataSet11.Locale = new System.Globalization.CultureInfo("sr-SP-Latn");
//
// dataGridTableStyle1
//
this.dataGridTableStyle1.DataGrid = this.dataGrid1;
this.dataGridTableStyle1.GridColumnStyles.AddRange(new System.Windows.Forms.DataGridColumnStyle[] {
this.dataGridTextBoxColumn1,
this.dataGridTextBoxColumn2,
this.dataGridTextBoxColumn3,
this.dataGridTextBoxColumn4});
this.dataGridTableStyle1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dataGridTableStyle1.MappingName = "Diskovi";
//
// dataGridTextBoxColumn1
//
this.dataGridTextBoxColumn1.Alignment = System.Windows.Forms.HorizontalAlignment.Center;
this.dataGridTextBoxColumn1.Format = "";
this.dataGridTextBoxColumn1.FormatInfo = null;
this.dataGridTextBoxColumn1.HeaderText = "R.b.";
this.dataGridTextBoxColumn1.MappingName = "Redni broj";
this.dataGridTextBoxColumn1.NullText = "";
this.dataGridTextBoxColumn1.ReadOnly = true;
this.dataGridTextBoxColumn1.Width = 60;
//
// dataGridTextBoxColumn2
//
this.dataGridTextBoxColumn2.Alignment = System.Windows.Forms.HorizontalAlignment.Center;
this.dataGridTextBoxColumn2.Format = "";
this.dataGridTextBoxColumn2.FormatInfo = null;
this.dataGridTextBoxColumn2.HeaderText = "Naslov Diska";
this.dataGridTextBoxColumn2.MappingName = "Naslov diska";
this.dataGridTextBoxColumn2.NullText = "";
this.dataGridTextBoxColumn2.Width = 170;
//
// dataGridTextBoxColumn3
//
this.dataGridTextBoxColumn3.Alignment = System.Windows.Forms.HorizontalAlignment.Center;
this.dataGridTextBoxColumn3.Format = "";
this.dataGridTextBoxColumn3.FormatInfo = null;
this.dataGridTextBoxColumn3.HeaderText = "Kategorija";
this.dataGridTextBoxColumn3.MappingName = "Kategorija";
this.dataGridTextBoxColumn3.NullText = "";
this.dataGridTextBoxColumn3.Width = 78;
//
// dataGridTextBoxColumn4
//
this.dataGridTextBoxColumn4.Alignment = System.Windows.Forms.HorizontalAlignment.Center;
this.dataGridTextBoxColumn4.Format = "";
this.dataGridTextBoxColumn4.FormatInfo = null;
this.dataGridTextBoxColumn4.HeaderText = "Pozajmica";
this.dataGridTextBoxColumn4.MappingName = "Nadimak";
this.dataGridTextBoxColumn4.NullText = "";
this.dataGridTextBoxColumn4.Width = 105;
//
// statusBar1
//
this.statusBar1.Location = new System.Drawing.Point(0, 342);
this.statusBar1.Name = "statusBar1";
this.statusBar1.Size = new System.Drawing.Size(744, 22);
this.statusBar1.TabIndex = 1;
//
// groupBox2
//
this.groupBox2.Controls.Add(this.label3);
this.groupBox2.Controls.Add(this.checkBox1);
this.groupBox2.Controls.Add(this.button4);
this.groupBox2.Controls.Add(this.button3);
this.groupBox2.Controls.Add(this.comboBox1);
this.groupBox2.Controls.Add(this.textBox2);
this.groupBox2.Location = new System.Drawing.Point(488, 8);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(248, 144);
this.groupBox2.TabIndex = 2;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Dodavanje diskova";
//
// label3
//
this.label3.Location = new System.Drawing.Point(32, 104);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(120, 23);
this.label3.TabIndex = 5;
this.label3.Text = "Dodavanje diskova";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.toolTip1.SetToolTip(this.label3, "Ukljucite da bi ste omogucili dodavanje diskova");
//
// checkBox1
//
this.checkBox1.Location = new System.Drawing.Point(16, 104);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(16, 24);
this.checkBox1.TabIndex = 4;
this.checkBox1.CheckStateChanged += new System.EventHandler(this.checkBox1_CheckStateChanged);
//
// button4
//
this.button4.Enabled = false;
this.button4.Location = new System.Drawing.Point(160, 104);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(80, 23);
this.button4.TabIndex = 3;
this.button4.Text = "Snimi u bazu";
this.toolTip1.SetToolTip(this.button4, "Po izvrsenju promena pritisni za update baze");
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// button3
//
this.button3.Enabled = false;
this.button3.Location = new System.Drawing.Point(160, 64);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(80, 24);
this.button3.TabIndex = 2;
this.button3.Text = "Dodaj CD";
this.toolTip1.SetToolTip(this.button3, "Po unosenju podataka pritisni dugme za dodavanje diskova");
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// comboBox1
//
this.comboBox1.CausesValidation = false;
this.comboBox1.DataSource = this.dataSet11;
this.comboBox1.DisplayMember = "Kategorija.Kategorija";
this.comboBox1.Enabled = false;
this.comboBox1.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.comboBox1.Location = new System.Drawing.Point(16, 64);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(136, 21);
this.comboBox1.TabIndex = 1;
this.comboBox1.ValueMember = "Kategorija.Kategorija";
//
// textBox2
//
this.textBox2.Enabled = false;
this.textBox2.Location = new System.Drawing.Point(16, 24);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(216, 20);
this.textBox2.TabIndex = 0;
this.textBox2.Text = "";
//
// groupBox3
//
this.groupBox3.Controls.Add(this.button2);
this.groupBox3.Location = new System.Drawing.Point(488, 256);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(248, 72);
this.groupBox3.TabIndex = 3;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Drugari";
//
// button2
//
this.button2.Image = ((System.Drawing.Image)(resources.GetObject("button2.Image")));
this.button2.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.button2.Location = new System.Drawing.Point(80, 32);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(88, 23);
this.button2.TabIndex = 1;
this.button2.Text = "Info o drugu";
this.button2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.toolTip1.SetToolTip(this.button2, "Informacije vezane za drugove");
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// textBox1
//
this.textBox1.Cursor = System.Windows.Forms.Cursors.Default;
this.textBox1.Location = new System.Drawing.Point(8, 336);
this.textBox1.Name = "textBox1";
this.textBox1.ReadOnly = true;
this.textBox1.Size = new System.Drawing.Size(736, 20);
this.textBox1.TabIndex = 4;
this.textBox1.Text = "CD Katalog by Mrdja Bojan";
this.textBox1.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// osveziBbutton
//
this.osveziBbutton.Image = ((System.Drawing.Image)(resources.GetObject("osveziBbutton.Image")));
this.osveziBbutton.Location = new System.Drawing.Point(176, 24);
this.osveziBbutton.Name = "osveziBbutton";
this.osveziBbutton.Size = new System.Drawing.Size(56, 48);
this.osveziBbutton.TabIndex = 4;
this.toolTip1.SetToolTip(this.osveziBbutton, "Osvezi bazu");
this.osveziBbutton.Click += new System.EventHandler(this.osveziBbutton_Click);
//
// label1
//
this.label1.Location = new System.Drawing.Point(8, 32);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(152, 23);
this.label1.TabIndex = 5;
this.label1.Text = "Osveži bazu podataka";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// groupBox4
//
this.groupBox4.Controls.Add(this.osveziBbutton);
this.groupBox4.Controls.Add(this.label1);
this.groupBox4.Location = new System.Drawing.Point(488, 160);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(248, 88);
this.groupBox4.TabIndex = 5;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "Baza podataka";
//
// oleDbSelectCommand1
//
this.oleDbSelectCommand1.CommandText = "SELECT Kategorija, Nadimak, [Naslov diska], [Redni broj] FROM Diskovi";
this.oleDbSelectCommand1.Connection = this.oleDbConnection1;
//
// oleDbConnection1
//
this.oleDbConnection1.ConnectionString = @"Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database Locking Mode=1;Jet OLEDB:Database Password=;Data Source=""D:\CD Katalog\cdkatalog.mdb"";Password=;Jet OLEDB:Engine Type=5;Jet OLEDB:Global Bulk Transactions=1;Provider=""Microsoft.Jet.OLEDB.4.0"";Jet OLEDB:System database=;Jet OLEDB:SFP=False;Extended Properties=;Mode=Share Deny None;Jet OLEDB:New Database Password=;Jet OLEDB:Create System Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;User ID=Admin;Jet OLEDB:Encrypt Database=False";
//
// oleDbInsertCommand1
//
this.oleDbInsertCommand1.CommandText = "INSERT INTO Diskovi(Kategorija, Nadimak, [Naslov diska]) VALUES (?, ?, ?)";
this.oleDbInsertCommand1.Connection = this.oleDbConnection1;
this.oleDbInsertCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Kategorija", System.Data.OleDb.OleDbType.VarWChar, 50, "Kategorija"));
this.oleDbInsertCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Nadimak", System.Data.OleDb.OleDbType.VarWChar, 50, "Nadimak"));
this.oleDbInsertCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Naslov_diska", System.Data.OleDb.OleDbType.VarWChar, 50, "Naslov diska"));
//
// oleDbUpdateCommand1
//
this.oleDbUpdateCommand1.CommandText = @"UPDATE Diskovi SET Kategorija = ?, Nadimak = ?, [Naslov diska] = ? WHERE ([Redni broj] = ?) AND (Kategorija = ? OR ? IS NULL AND Kategorija IS NULL) AND (Nadimak = ? OR ? IS NULL AND Nadimak IS NULL) AND ([Naslov diska] = ? OR ? IS NULL AND [Naslov diska] IS NULL)";
this.oleDbUpdateCommand1.Connection = this.oleDbConnection1;
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Kategorija", System.Data.OleDb.OleDbType.VarWChar, 50, "Kategorija"));
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Nadimak", System.Data.OleDb.OleDbType.VarWChar, 50, "Nadimak"));
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Naslov_diska", System.Data.OleDb.OleDbType.VarWChar, 50, "Naslov diska"));
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_Redni_broj", System.Data.OleDb.OleDbType.Integer, 0, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Redni broj", System.Data.DataRowVersion.Original, null));
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_Kategorija", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Kategorija", System.Data.DataRowVersion.Original, null));
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_Kategorija1", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Kategorija", System.Data.DataRowVersion.Original, null));
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_Nadimak", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Nadimak", System.Data.DataRowVersion.Original, null));
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_Nadimak1", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Nadimak", System.Data.DataRowVersion.Original, null));
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_Naslov_diska", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Naslov diska", System.Data.DataRowVersion.Original, null));
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_Naslov_diska1", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Naslov diska", System.Data.DataRowVersion.Original, null));
//
// oleDbDeleteCommand1
//
this.oleDbDeleteCommand1.CommandText = "DELETE FROM Diskovi WHERE ([Redni broj] = ?) AND (Kategorija = ? OR ? IS NULL AND" +
" Kategorija IS NULL) AND (Nadimak = ? OR ? IS NULL AND Nadimak IS NULL) AND ([Na" +
"slov diska] = ? OR ? IS NULL AND [Naslov diska] IS NULL)";
this.oleDbDeleteCommand1.Connection = this.oleDbConnection1;
this.oleDbDeleteCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_Redni_broj", System.Data.OleDb.OleDbType.Integer, 0, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Redni broj", System.Data.DataRowVersion.Original, null));
this.oleDbDeleteCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_Kategorija", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Kategorija", System.Data.DataRowVersion.Original, null));
this.oleDbDeleteCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_Kategorija1", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Kategorija", System.Data.DataRowVersion.Original, null));
this.oleDbDeleteCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_Nadimak", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Nadimak", System.Data.DataRowVersion.Original, null));
this.oleDbDeleteCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_Nadimak1", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Nadimak", System.Data.DataRowVersion.Original, null));
this.oleDbDeleteCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_Naslov_diska", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Naslov diska", System.Data.DataRowVersion.Original, null));
this.oleDbDeleteCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_Naslov_diska1", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Naslov diska", System.Data.DataRowVersion.Original, null));
//
// oleDbDataAdapter1
//
this.oleDbDataAdapter1.DeleteCommand = this.oleDbDeleteCommand1;
this.oleDbDataAdapter1.InsertCommand = this.oleDbInsertCommand1;
this.oleDbDataAdapter1.SelectCommand = this.oleDbSelectCommand1;
this.oleDbDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "Diskovi", new System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("Kategorija", "Kategorija"),
new System.Data.Common.DataColumnMapping("Nadimak", "Nadimak"),
new System.Data.Common.DataColumnMapping("Naslov diska", "Naslov diska"),
new System.Data.Common.DataColumnMapping("Redni broj", "Redni broj")})});
this.oleDbDataAdapter1.UpdateCommand = this.oleDbUpdateCommand1;
//
// oleDbSelectCommand2
//
this.oleDbSelectCommand2.CommandText = "SELECT Kategorija FROM Kategorija";
this.oleDbSelectCommand2.Connection = this.oleDbConnection1;
//
// oleDbInsertCommand2
//
this.oleDbInsertCommand2.CommandText = "INSERT INTO Kategorija(Kategorija) VALUES (?)";
this.oleDbInsertCommand2.Connection = this.oleDbConnection1;
this.oleDbInsertCommand2.Parameters.Add(new System.Data.OleDb.OleDbParameter("Kategorija", System.Data.OleDb.OleDbType.VarWChar, 50, "Kategorija"));
//
// oleDbUpdateCommand2
//
this.oleDbUpdateCommand2.CommandText = "UPDATE Kategorija SET Kategorija = ? WHERE (Kategorija = ?)";
this.oleDbUpdateCommand2.Connection = this.oleDbConnection1;
this.oleDbUpdateCommand2.Parameters.Add(new System.Data.OleDb.OleDbParameter("Kategorija", System.Data.OleDb.OleDbType.VarWChar, 50, "Kategorija"));
this.oleDbUpdateCommand2.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_Kategorija", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Kategorija", System.Data.DataRowVersion.Original, null));
//
// oleDbDeleteCommand2
//
this.oleDbDeleteCommand2.CommandText = "DELETE FROM Kategorija WHERE (Kategorija = ?)";
this.oleDbDeleteCommand2.Connection = this.oleDbConnection1;
this.oleDbDeleteCommand2.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_Kategorija", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Kategorija", System.Data.DataRowVersion.Original, null));
//
// oleDbDataAdapter2
//
this.oleDbDataAdapter2.DeleteCommand = this.oleDbDeleteCommand2;
this.oleDbDataAdapter2.InsertCommand = this.oleDbInsertCommand2;
this.oleDbDataAdapter2.SelectCommand = this.oleDbSelectCommand2;
this.oleDbDataAdapter2.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "Kategorija", new System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("Kategorija", "Kategorija")})});
this.oleDbDataAdapter2.UpdateCommand = this.oleDbUpdateCommand2;
//
// Forma1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(744, 364);
this.Controls.Add(this.groupBox4);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.groupBox3);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.statusBar1);
this.Controls.Add(this.groupBox1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.Menu = this.mainMenu1;
this.Name = "Forma1";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "CD Katalog";
this.Closing += new System.ComponentModel.CancelEventHandler(this.Forma1_Closing);
this.Load += new System.EventHandler(this.Forma1_Load);
this.groupBox1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dataSet11)).EndInit();
this.groupBox2.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.groupBox4.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
//ucitavanje frm = new ucitavanje();
Application.Run(new Forma1());
}
private void menuItem10_Click(object sender, System.EventArgs e)
{
oMeni prvaForma=new oMeni();
prvaForma.Show();
}
private void button3_Click(object sender, System.EventArgs e)
{
string temp=textBox1.Text.Trim();
if(temp=="")
{
MessageBox.Show("Morate uneti ime diska","Obaveštenje",MessageBoxButtons.OK,MessageBoxIcon.Warning);
return;
}
dataSet11.Diskovi.AddDiskoviRow(comboBox1.SelectedValue.ToString(),"",textBox2.Text);
textBox2.Clear();
}
private void Forma1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
if (MessageBox.Show("Da li ste sigurni da želite da napustite program?",
"Potvrda izlaza",MessageBoxButtons.YesNo,MessageBoxIcon.Warning)==DialogResult.No)
e.Cancel=true;
}
private void Forma1_Load(object sender, System.EventArgs e)
{
try
{
oleDbDataAdapter1.Fill(dataSet11);
}
catch
{
MessageBox.Show("Nemogu da nadem bazu podataka!","Greška",MessageBoxButtons.OK,MessageBoxIcon.Error);
Application.Exit();
}
try
{
oleDbDataAdapter2.Fill(dataSet11);
}
catch
{
MessageBox.Show("Nemogu da nadem bazu podataka!","Greška",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
private void button2_Click(object sender, System.EventArgs e)
{
drugovi drugaForma=new drugovi();
drugaForma.Show();
}
private void osveziBbutton_Click(object sender, System.EventArgs e)
{
oleDbDataAdapter1.Update(dataSet11);
}
private void button4_Click(object sender, System.EventArgs e)
{
oleDbDataAdapter1.Update(dataSet11);
}
private void menuItem3_Click_1(object sender, System.EventArgs e)
{
this.Close();
}
private void textBox3_TextChanged(object sender, System.EventArgs e)
{
try
{
oleDbDataAdapter1.SelectCommand.CommandText="SELECT * FROM Diskovi WHERE ([Naslov diska] LIKE '"+textBox3.Text+"*')";
//MessageBox.Show("SELECT [Naslov diska]* FROM Diskovi WHERE (Diskovi.Naslov diska LIKE '"+textBox3.Text+"*')");
dataSet11.Clear();
oleDbDataAdapter1.Fill( dataSet11);
//oleDbDataAdapter1.SelectCommand.CommandText="SELECT * FROM Diskovi WHERE Naslov diska LIKE '"+textBox1.Text+"*'";
//oleDbDataAdapter1.SelectCommand.CommandText="SELECT * FROM Diskovi WHERE ([Naslov diska] LIKE '"+textBox3.Text+"*')";
//dataSet11.Clear();
//oleDbDataAdapter1.Fill( dataSet11);
// sledecu liniju ne ubacuješ ako ti je grid staticki vezan za dataSet
//dataGrid1.DataSource=dataSet11;
//ova linije ja ono što tebi fali
//dataGrid1.SetDataBinding(dataSet11, "Diskovi");
}
catch
{
MessageBox.Show("Greska","Greska",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
private void checkBox1_CheckStateChanged(object sender, System.EventArgs e)
{
if (checkBox1.Checked==true)
{
this.textBox2.Enabled=true;
this.button3.Enabled=true;
this.button4.Enabled=true;
this.comboBox1.Enabled=true;
}
else
{
this.textBox2.Enabled=false;
this.button3.Enabled=false;
this.button4.Enabled=false;
this.comboBox1.Enabled=false;
}
}
}
}
e, pa ovo je sve, ako nekom nesto jos treba da provali sta je, neka kaze sta jos da okacim na forum.Hvala