When I put the DateTimePicker on the windows form and conect them with database (sql data adapter) and add new record I get current date in the field.
that is OK , but when I start update metod of sql dataad apter the date on the Date Time Picker is not reflect in the database.
Does enybody know Why?
3 2303
Would you like to post your sample codes here so we can analyze waht your problem is? Just double check your update query
Rey Sean
Hallo Ray, thank you for help. The code follow - using System;
-
using System.Drawing;
-
using System.Collections;
-
using System.ComponentModel;
-
using System.Windows.Forms;
-
using System.Data;
-
-
-
namespace projekat
-
{
-
/// <summary>
-
/// Summary description for Form1.
-
/// </summary>
-
public class Form1 : System.Windows.Forms.Form
-
{
-
private System.Windows.Forms.ToolBar toolBar1;
-
private System.Windows.Forms.ImageList imageList1;
-
private System.Windows.Forms.ToolBarButton tbb1;
-
private System.Windows.Forms.ToolBarButton tbb2;
-
private System.Windows.Forms.ToolBarButton tbb3;
-
private System.Windows.Forms.ToolBarButton tbb4;
-
private System.Data.SqlClient.SqlDataAdapter sqlDataAdapter1;
-
private System.Data.SqlClient.SqlCommand sqlSelectCommand1;
-
private System.Data.SqlClient.SqlCommand sqlInsertCommand1;
-
private System.Data.SqlClient.SqlCommand sqlUpdateCommand1;
-
private System.Data.SqlClient.SqlCommand sqlDeleteCommand1;
-
private System.Data.SqlClient.SqlConnection sqlConnection1;
-
private projekat.DataSet1 dataSet11;
-
private System.Windows.Forms.TextBox naziv;
-
private System.Windows.Forms.TextBox pdv;
-
public System.Windows.Forms.DateTimePicker valuta;
-
-
private System.Data.SqlClient.SqlDataAdapter sqlDataAdapter2;
-
private System.Data.SqlClient.SqlCommand sqlSelectCommand2;
-
private System.Data.SqlClient.SqlCommand sqlInsertCommand2;
-
private System.Data.SqlClient.SqlCommand sqlUpdateCommand2;
-
private System.Data.SqlClient.SqlCommand sqlDeleteCommand2;
-
private projekat.DataSet2 dataSet21;
-
private System.Windows.Forms.Button button1;
-
private System.Windows.Forms.Button button2;
-
private System.Windows.Forms.ComboBox comboBox1;
-
public System.Windows.Forms.ComboBox comboBox2;
-
private System.Windows.Forms.Label label1;
-
private System.Windows.Forms.Label label2;
-
private System.Windows.Forms.Label label3;
-
private System.Windows.Forms.Label label4;
-
private System.Windows.Forms.Label label5;
-
private System.Windows.Forms.Label label6;
-
private System.ComponentModel.IContainer components;
-
public DateTime dt;
-
-
public Form1()
-
{
-
-
//
-
// 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(Form1));
-
this.toolBar1 = new System.Windows.Forms.ToolBar();
-
this.tbb1 = new System.Windows.Forms.ToolBarButton();
-
this.tbb2 = new System.Windows.Forms.ToolBarButton();
-
this.tbb3 = new System.Windows.Forms.ToolBarButton();
-
this.tbb4 = new System.Windows.Forms.ToolBarButton();
-
this.imageList1 = new System.Windows.Forms.ImageList(this.components);
-
this.sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter();
-
this.sqlDeleteCommand1 = new System.Data.SqlClient.SqlCommand();
-
this.sqlConnection1 = new System.Data.SqlClient.SqlConnection();
-
this.sqlInsertCommand1 = new System.Data.SqlClient.SqlCommand();
-
this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();
-
this.sqlUpdateCommand1 = new System.Data.SqlClient.SqlCommand();
-
this.dataSet11 = new projekat.DataSet1();
-
this.naziv = new System.Windows.Forms.TextBox();
-
this.pdv = new System.Windows.Forms.TextBox();
-
this.dataSet21 = new projekat.DataSet2();
-
this.valuta = new System.Windows.Forms.DateTimePicker();
-
this.sqlDataAdapter2 = new System.Data.SqlClient.SqlDataAdapter();
-
this.sqlDeleteCommand2 = new System.Data.SqlClient.SqlCommand();
-
this.sqlInsertCommand2 = new System.Data.SqlClient.SqlCommand();
-
this.sqlSelectCommand2 = new System.Data.SqlClient.SqlCommand();
-
this.sqlUpdateCommand2 = new System.Data.SqlClient.SqlCommand();
-
this.button1 = new System.Windows.Forms.Button();
-
this.button2 = new System.Windows.Forms.Button();
-
this.comboBox1 = new System.Windows.Forms.ComboBox();
-
this.comboBox2 = new System.Windows.Forms.ComboBox();
-
this.label1 = new System.Windows.Forms.Label();
-
this.label2 = new System.Windows.Forms.Label();
-
this.label3 = new System.Windows.Forms.Label();
-
this.label4 = new System.Windows.Forms.Label();
-
this.label5 = new System.Windows.Forms.Label();
-
this.label6 = new System.Windows.Forms.Label();
-
((System.ComponentModel.ISupportInitialize)(this.dataSet11)).BeginInit();
-
((System.ComponentModel.ISupportInitialize)(this.dataSet21)).BeginInit();
-
this.SuspendLayout();
-
//
-
// toolBar1
-
//
-
this.toolBar1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
-
this.toolBar1.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] {
-
this.tbb1,
-
this.tbb2,
-
this.tbb3,
-
this.tbb4});
-
this.toolBar1.ButtonSize = new System.Drawing.Size(32, 31);
-
this.toolBar1.DropDownArrows = true;
-
this.toolBar1.ImageList = this.imageList1;
-
this.toolBar1.Location = new System.Drawing.Point(0, 0);
-
this.toolBar1.Name = "toolBar1";
-
this.toolBar1.ShowToolTips = true;
-
this.toolBar1.Size = new System.Drawing.Size(632, 38);
-
this.toolBar1.TabIndex = 0;
-
this.toolBar1.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar1_ButtonClick);
-
//
-
// tbb1
-
//
-
this.tbb1.ImageIndex = 0;
-
this.tbb1.ToolTipText = "New";
-
//
-
// tbb2
-
//
-
this.tbb2.ImageIndex = 1;
-
this.tbb2.ToolTipText = "Save";
-
//
-
// tbb3
-
//
-
this.tbb3.ImageIndex = 2;
-
this.tbb3.ToolTipText = "Delete";
-
//
-
// tbb4
-
//
-
this.tbb4.ImageIndex = 3;
-
this.tbb4.ToolTipText = "Kraj";
-
//
-
// imageList1
-
//
-
this.imageList1.ImageSize = new System.Drawing.Size(20, 20);
-
this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
-
this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
-
//
-
// sqlDataAdapter1
-
//
-
this.sqlDataAdapter1.DeleteCommand = this.sqlDeleteCommand1;
-
this.sqlDataAdapter1.InsertCommand = this.sqlInsertCommand1;
-
this.sqlDataAdapter1.SelectCommand = this.sqlSelectCommand1;
-
this.sqlDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
-
new System.Data.Common.DataTableMapping("Table", "faktura", new System.Data.Common.DataColumnMapping[] {
-
new System.Data.Common.DataColumnMapping("idfak", "idfak"),
-
new System.Data.Common.DataColumnMapping("iddob", "iddob"),
-
new System.Data.Common.DataColumnMapping("naziv", "naziv"),
-
new System.Data.Common.DataColumnMapping("valuta", "valuta"),
-
new System.Data.Common.DataColumnMapping("pdv", "pdv")})});
-
this.sqlDataAdapter1.UpdateCommand = this.sqlUpdateCommand1;
-
//
-
// sqlDeleteCommand1
-
//
-
this.sqlDeleteCommand1.CommandText = @"DELETE FROM faktura WHERE (idfak = @Original_idfak) AND (iddob = @Original_iddob OR @Original_iddob IS NULL AND iddob IS NULL) AND (pdv = @Original_pdv OR @Original_pdv IS NULL AND pdv IS NULL) AND (valuta = @Original_valuta OR @Original_valuta IS NULL AND valuta IS NULL)";
-
this.sqlDeleteCommand1.Connection = this.sqlConnection1;
-
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_idfak", System.Data.SqlDbType.BigInt, 8, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "idfak", System.Data.DataRowVersion.Original, null));
-
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_iddob", System.Data.SqlDbType.BigInt, 8, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "iddob", System.Data.DataRowVersion.Original, null));
-
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_pdv", System.Data.SqlDbType.Decimal, 9, System.Data.ParameterDirection.Input, false, ((System.Byte)(18)), ((System.Byte)(0)), "pdv", System.Data.DataRowVersion.Original, null));
-
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_valuta", System.Data.SqlDbType.DateTime, 8, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "valuta", System.Data.DataRowVersion.Original, null));
-
//
-
// sqlConnection1
-
//
-
this.sqlConnection1.ConnectionString = "workstation id=DEJAN;packet size=4096;integrated security=SSPI;data source=DEJAN;" +
-
"persist security info=False;initial catalog=probna";
-
//
-
// sqlInsertCommand1
-
//
-
this.sqlInsertCommand1.CommandText = "INSERT INTO faktura(iddob, naziv, valuta, pdv) VALUES (@iddob, @naziv, @valuta, @" +
-
"pdv); SELECT idfak, iddob, naziv, valuta, pdv FROM faktura WHERE (idfak = @@IDEN" +
-
"TITY)";
-
this.sqlInsertCommand1.Connection = this.sqlConnection1;
-
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@iddob", System.Data.SqlDbType.BigInt, 8, "iddob"));
-
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@naziv", System.Data.SqlDbType.VarChar, 2147483647, "naziv"));
-
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@valuta", System.Data.SqlDbType.DateTime, 8, "valuta"));
-
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@pdv", System.Data.SqlDbType.Decimal, 9, System.Data.ParameterDirection.Input, false, ((System.Byte)(18)), ((System.Byte)(0)), "pdv", System.Data.DataRowVersion.Current, null));
-
//
-
// sqlSelectCommand1
-
//
-
this.sqlSelectCommand1.CommandText = "SELECT idfak, iddob, naziv, valuta, pdv FROM faktura";
-
this.sqlSelectCommand1.Connection = this.sqlConnection1;
-
//
-
// sqlUpdateCommand1
-
//
-
this.sqlUpdateCommand1.CommandText = @"UPDATE faktura SET iddob = @iddob, naziv = @naziv, valuta = @valuta, pdv = @pdv WHERE (idfak = @Original_idfak) AND (iddob = @Original_iddob OR @Original_iddob IS NULL AND iddob IS NULL) AND (pdv = @Original_pdv OR @Original_pdv IS NULL AND pdv IS NULL) AND (valuta = @Original_valuta OR @Original_valuta IS NULL AND valuta IS NULL); SELECT idfak, iddob, naziv, valuta, pdv FROM faktura WHERE (idfak = @idfak)";
-
this.sqlUpdateCommand1.Connection = this.sqlConnection1;
-
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@iddob", System.Data.SqlDbType.BigInt, 8, "iddob"));
-
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@naziv", System.Data.SqlDbType.VarChar, 2147483647, "naziv"));
-
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@valuta", System.Data.SqlDbType.DateTime, 8, "valuta"));
-
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@pdv", System.Data.SqlDbType.Decimal, 9, System.Data.ParameterDirection.Input, false, ((System.Byte)(18)), ((System.Byte)(0)), "pdv", System.Data.DataRowVersion.Current, null));
-
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_idfak", System.Data.SqlDbType.BigInt, 8, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "idfak", System.Data.DataRowVersion.Original, null));
-
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_iddob", System.Data.SqlDbType.BigInt, 8, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "iddob", System.Data.DataRowVersion.Original, null));
-
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_pdv", System.Data.SqlDbType.Decimal, 9, System.Data.ParameterDirection.Input, false, ((System.Byte)(18)), ((System.Byte)(0)), "pdv", System.Data.DataRowVersion.Original, null));
-
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_valuta", System.Data.SqlDbType.DateTime, 8, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "valuta", System.Data.DataRowVersion.Original, null));
-
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@idfak", System.Data.SqlDbType.BigInt, 8, "idfak"));
-
//
-
// dataSet11
-
//
-
this.dataSet11.DataSetName = "DataSet1";
-
this.dataSet11.Locale = new System.Globalization.CultureInfo("en-GB");
-
//
-
// naziv
-
//
-
this.naziv.Anchor = System.Windows.Forms.AnchorStyles.Top;
-
this.naziv.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "faktura.naziv"));
-
this.naziv.Location = new System.Drawing.Point(168, 128);
-
this.naziv.Name = "naziv";
-
this.naziv.Size = new System.Drawing.Size(360, 20);
-
this.naziv.TabIndex = 4;
-
this.naziv.Text = "";
-
//
-
// pdv
-
//
-
this.pdv.Anchor = System.Windows.Forms.AnchorStyles.Top;
-
this.pdv.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "faktura.pdv"));
-
this.pdv.Location = new System.Drawing.Point(376, 168);
-
this.pdv.Name = "pdv";
-
this.pdv.Size = new System.Drawing.Size(48, 20);
-
this.pdv.TabIndex = 5;
-
this.pdv.Text = "";
-
this.pdv.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
-
//
-
// dataSet21
-
//
-
this.dataSet21.DataSetName = "DataSet2";
-
this.dataSet21.Locale = new System.Globalization.CultureInfo("en-GB");
-
//
-
// valuta
-
//
-
this.valuta.AccessibleRole = System.Windows.Forms.AccessibleRole.Window;
-
this.valuta.Anchor = System.Windows.Forms.AnchorStyles.Top;
-
this.valuta.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "faktura.valuta"));
-
this.valuta.Format = System.Windows.Forms.DateTimePickerFormat.Short;
-
this.valuta.ImeMode = System.Windows.Forms.ImeMode.HangulFull;
-
this.valuta.Location = new System.Drawing.Point(300, 80);
-
this.valuta.Name = "valuta";
-
this.valuta.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
-
this.valuta.Size = new System.Drawing.Size(92, 20);
-
this.valuta.TabIndex = 2;
-
this.valuta.Value = new System.DateTime(2009, 11, 26, 0, 0, 0, 0);
-
//
-
// sqlDataAdapter2
-
//
-
this.sqlDataAdapter2.DeleteCommand = this.sqlDeleteCommand2;
-
this.sqlDataAdapter2.InsertCommand = this.sqlInsertCommand2;
-
this.sqlDataAdapter2.SelectCommand = this.sqlSelectCommand2;
-
this.sqlDataAdapter2.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
-
new System.Data.Common.DataTableMapping("Table", "dobavljac", new System.Data.Common.DataColumnMapping[] {
-
new System.Data.Common.DataColumnMapping("iddobavljac", "iddobavljac"),
-
new System.Data.Common.DataColumnMapping("naziv", "naziv")})});
-
this.sqlDataAdapter2.UpdateCommand = this.sqlUpdateCommand2;
-
//
-
// sqlDeleteCommand2
-
//
-
this.sqlDeleteCommand2.CommandText = "DELETE FROM dobavljac WHERE (iddobavljac = @Original_iddobavljac) AND (naziv = @O" +
-
"riginal_naziv OR @Original_naziv IS NULL AND naziv IS NULL)";
-
this.sqlDeleteCommand2.Connection = this.sqlConnection1;
-
this.sqlDeleteCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_iddobavljac", System.Data.SqlDbType.BigInt, 8, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "iddobavljac", System.Data.DataRowVersion.Original, null));
-
this.sqlDeleteCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_naziv", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "naziv", System.Data.DataRowVersion.Original, null));
-
//
-
// sqlInsertCommand2
-
//
-
this.sqlInsertCommand2.CommandText = "INSERT INTO dobavljac(naziv) VALUES (@naziv); SELECT iddobavljac, naziv FROM doba" +
-
"vljac WHERE (iddobavljac = @@IDENTITY)";
-
this.sqlInsertCommand2.Connection = this.sqlConnection1;
-
this.sqlInsertCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@naziv", System.Data.SqlDbType.VarChar, 50, "naziv"));
-
//
-
// sqlSelectCommand2
-
//
-
this.sqlSelectCommand2.CommandText = "SELECT iddobavljac, naziv FROM dobavljac";
-
this.sqlSelectCommand2.Connection = this.sqlConnection1;
-
//
-
// sqlUpdateCommand2
-
//
-
this.sqlUpdateCommand2.CommandText = "UPDATE dobavljac SET naziv = @naziv WHERE (iddobavljac = @Original_iddobavljac) A" +
-
"ND (naziv = @Original_naziv OR @Original_naziv IS NULL AND naziv IS NULL); SELEC" +
-
"T iddobavljac, naziv FROM dobavljac WHERE (iddobavljac = @iddobavljac)";
-
this.sqlUpdateCommand2.Connection = this.sqlConnection1;
-
this.sqlUpdateCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@naziv", System.Data.SqlDbType.VarChar, 50, "naziv"));
-
this.sqlUpdateCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_iddobavljac", System.Data.SqlDbType.BigInt, 8, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "iddobavljac", System.Data.DataRowVersion.Original, null));
-
this.sqlUpdateCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_naziv", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "naziv", System.Data.DataRowVersion.Original, null));
-
this.sqlUpdateCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@iddobavljac", System.Data.SqlDbType.BigInt, 8, "iddobavljac"));
-
//
-
// button1
-
//
-
this.button1.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
-
this.button1.Image = ((System.Drawing.Image)(resources.GetObject("button1.Image")));
-
this.button1.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
-
this.button1.Location = new System.Drawing.Point(192, 232);
-
this.button1.Name = "button1";
-
this.button1.Size = new System.Drawing.Size(64, 23);
-
this.button1.TabIndex = 2;
-
this.button1.TabStop = false;
-
this.button1.Text = "Next";
-
this.button1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
-
this.button1.Click += new System.EventHandler(this.button1_Click);
-
//
-
// button2
-
//
-
this.button2.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
-
this.button2.Image = ((System.Drawing.Image)(resources.GetObject("button2.Image")));
-
this.button2.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
-
this.button2.Location = new System.Drawing.Point(328, 232);
-
this.button2.Name = "button2";
-
this.button2.Size = new System.Drawing.Size(64, 23);
-
this.button2.TabIndex = 7;
-
this.button2.TabStop = false;
-
this.button2.Text = "Prev";
-
this.button2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
-
this.button2.Click += new System.EventHandler(this.button2_Click);
-
//
-
// comboBox1
-
//
-
this.comboBox1.Anchor = System.Windows.Forms.AnchorStyles.Top;
-
this.comboBox1.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "faktura.idfak"));
-
this.comboBox1.DataSource = this.dataSet11;
-
this.comboBox1.DisplayMember = "faktura.idfak";
-
this.comboBox1.Location = new System.Drawing.Point(92, 80);
-
this.comboBox1.Name = "comboBox1";
-
this.comboBox1.Size = new System.Drawing.Size(84, 21);
-
this.comboBox1.TabIndex = 1;
-
this.comboBox1.ValueMember = "idfak";
-
//
-
// comboBox2
-
//
-
this.comboBox2.Anchor = System.Windows.Forms.AnchorStyles.Top;
-
this.comboBox2.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet21, "dobavljac.naziv"));
-
this.comboBox2.DataBindings.Add(new System.Windows.Forms.Binding("SelectedValue", this.dataSet11, "faktura.iddob"));
-
this.comboBox2.DataSource = this.dataSet21.dobavljac;
-
this.comboBox2.DisplayMember = "naziv";
-
this.comboBox2.Location = new System.Drawing.Point(492, 80);
-
this.comboBox2.Name = "comboBox2";
-
this.comboBox2.Size = new System.Drawing.Size(121, 21);
-
this.comboBox2.TabIndex = 3;
-
this.comboBox2.ValueMember = "iddobavljac";
-
this.comboBox2.SelectedIndexChanged += new System.EventHandler(this.promena);
-
//
-
// label1
-
//
-
this.label1.BackColor = System.Drawing.SystemColors.Info;
-
this.label1.Dock = System.Windows.Forms.DockStyle.Top;
-
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
-
this.label1.Location = new System.Drawing.Point(0, 38);
-
this.label1.Name = "label1";
-
this.label1.Size = new System.Drawing.Size(632, 23);
-
this.label1.TabIndex = 10;
-
this.label1.Text = "Faktura";
-
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
-
//
-
// label2
-
//
-
this.label2.Anchor = System.Windows.Forms.AnchorStyles.Top;
-
this.label2.Location = new System.Drawing.Point(20, 80);
-
this.label2.Name = "label2";
-
this.label2.Size = new System.Drawing.Size(56, 20);
-
this.label2.TabIndex = 11;
-
this.label2.Text = "ID";
-
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
-
//
-
// label3
-
//
-
this.label3.Anchor = System.Windows.Forms.AnchorStyles.Top;
-
this.label3.Location = new System.Drawing.Point(244, 80);
-
this.label3.Name = "label3";
-
this.label3.Size = new System.Drawing.Size(40, 20);
-
this.label3.TabIndex = 12;
-
this.label3.Text = "Valuta";
-
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
-
//
-
// label4
-
//
-
this.label4.Anchor = System.Windows.Forms.AnchorStyles.Top;
-
this.label4.Location = new System.Drawing.Point(388, 80);
-
this.label4.Name = "label4";
-
this.label4.Size = new System.Drawing.Size(100, 20);
-
this.label4.TabIndex = 13;
-
this.label4.Text = "Costumers";
-
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
-
//
-
// label5
-
//
-
this.label5.Anchor = System.Windows.Forms.AnchorStyles.Top;
-
this.label5.Location = new System.Drawing.Point(112, 128);
-
this.label5.Name = "label5";
-
this.label5.Size = new System.Drawing.Size(40, 23);
-
this.label5.TabIndex = 14;
-
this.label5.Text = "Detail";
-
this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
-
//
-
// label6
-
//
-
this.label6.Anchor = System.Windows.Forms.AnchorStyles.Top;
-
this.label6.Location = new System.Drawing.Point(312, 168);
-
this.label6.Name = "label6";
-
this.label6.Size = new System.Drawing.Size(48, 20);
-
this.label6.TabIndex = 15;
-
this.label6.Text = "Pdv";
-
this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
-
//
-
// Form1
-
//
-
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
-
this.ClientSize = new System.Drawing.Size(632, 273);
-
this.Controls.Add(this.label6);
-
this.Controls.Add(this.label5);
-
this.Controls.Add(this.label4);
-
this.Controls.Add(this.label3);
-
this.Controls.Add(this.label2);
-
this.Controls.Add(this.label1);
-
this.Controls.Add(this.comboBox2);
-
this.Controls.Add(this.comboBox1);
-
this.Controls.Add(this.button2);
-
this.Controls.Add(this.button1);
-
this.Controls.Add(this.valuta);
-
this.Controls.Add(this.pdv);
-
this.Controls.Add(this.naziv);
-
this.Controls.Add(this.toolBar1);
-
this.Name = "Form1";
-
this.Text = "Form1";
-
this.Load += new System.EventHandler(this.Form1_Load);
-
((System.ComponentModel.ISupportInitialize)(this.dataSet11)).EndInit();
-
((System.ComponentModel.ISupportInitialize)(this.dataSet21)).EndInit();
-
this.ResumeLayout(false);
-
-
}
-
#endregion
-
-
/// <summary>
-
/// The main entry point for the application.
-
/// </summary>
-
[STAThread]
-
static void Main()
-
{
-
Application.Run(new Form1());
-
-
}
-
-
private void Form1_Load(object sender, System.EventArgs e)
-
{
-
this.sqlDataAdapter1.Fill(this.dataSet11,0,0,"faktura");
-
this.sqlDataAdapter2.Fill(this.dataSet21,0,0,"dobavljac");
-
-
//
-
-
-
}
-
-
-
private void button1_Click(object sender, System.EventArgs e)
-
{
-
this.BindingContext[this.dataSet11,"faktura"].Position++;
-
-
//
-
-
}
-
-
-
private void button2_Click(object sender, System.EventArgs e)
-
{
-
this.BindingContext[this.dataSet11,"faktura"].Position--;
-
-
}
-
-
private void toolBar1_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
-
{
-
if (e.Button.ImageIndex==0)
-
{
-
-
this.BindingContext[this.dataSet11,"faktura"].AddNew();
-
-
-
-
}
-
if (e.Button.ImageIndex==1)
-
{
-
-
this.BindingContext[this.dataSet11,"faktura"].EndCurrentEdit();
-
-
this.sqlDataAdapter1.Update(this.dataSet11,"faktura");
-
-
}
-
if(e.Button.ImageIndex==2)
-
{
-
int i=this.BindingContext[this.dataSet11,"faktura"].Position;
-
this.BindingContext[this.dataSet11,"faktura"].RemoveAt(i);
-
}
-
-
}
-
-
private void promena(object sender, System.EventArgs e)
-
{
-
ComboBox cv=(ComboBox)sender;
-
if (cv.SelectedIndex==0)
-
cv.SelectedIndex=-1;
-
-
}
-
-
-
-
}
-
}
tlhintoq 3,525
Recognized Expert Specialist TIP: When you are writing your question, there is a button on the tool bar that wraps the [code] tags around your copy/pasted code. It helps a bunch. Its the button with a '#' on it. More on tags. They're cool. Check'em out. Sign in to post your reply or Sign up for a free account.
Similar topics
by: angelag |
last post by:
I am currently taking a college course in Visual Basic.Net and I am a
beginner.
I bought Visual Studio.Net 2003 to do my homework at home. I built my
first project and e-mailed it to myself at...
|
by: Martin Bless |
last post by:
The good news:
Along with Python-2.4 comes really good news to Windows users. Yes,
you now CAN build extension modules yourself using the SAME C++
compiler and linker Python is built with...
|
by: Tom Lee |
last post by:
Hi,
I'm new to .NET 2003 compiler. When I tried to compile my
program using DEBUG mode, I got the following errors in the
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7
\include\xdebug...
|
by: Daniel A. Thomas |
last post by:
License required
Maybe you don't have this but have one of the products that
qualifies for the upgrade such as ...
Visual Studio .NET 2003 Professional
Visual Studio .NET 2003 Professional...
|
by: Bruno Jouhier [MVP] |
last post by:
I'm currently experiencing a strange phenomenon:
At my Office, Visual Studio takes a very long time to compile our solution
(more than 1 minute for the first project).
At home, Visual Studio...
|
by: Guy |
last post by:
I have extended the datetimepicker control to incorporate
a ReadOnly property.
I have used the new keyword to implement my own version
of the value property, so that if readonly == true then
it...
|
by: Ed Crowley |
last post by:
I have a DateTimePicker control on my form that is displaying the date
format in UK format (dd/mm/yy).
However, in my code dtpStartDate.Value gives a date in US format, but...
|
by: aaaa |
last post by:
After this code:
DateTimePicker1.Enable = false;
The back color of the datetimepicker back color stay gray. I want it stay
white. How can i do this???
Visual Studio 2003
|
by: =?Utf-8?B?QW5pcnVkZGhh?= |
last post by:
Hi,
I am building an windows application using Visual Studio 2005 (VB.NET). I
would like to use a System.Windows.Forms.DateTimePicker. The default value is
showing as syatem date. How can I show...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |