Might you look in the code
using System;
using System.Drawing;
using System.Collecti ons;
using System.Componen tModel;
using System.Windows. Forms;
using System.Data;
namespace Autocentras2
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows. Forms.Form
{
private System.Data.Sql Client.SqlConne ction sqlConnection1;
private System.Data.Sql Client.SqlComma nd sqlSelectComman d1;
private System.Data.Sql Client.SqlComma nd sqlInsertComman d1;
private System.Data.Sql Client.SqlComma nd sqlUpdateComman d1;
private System.Data.Sql Client.SqlComma nd sqlDeleteComman d1;
private System.Data.Sql Client.SqlDataA dapter aGamintojas;
private Autocentras2.ds _gam ds_gam1;
private System.Windows. Forms.Button button1;
/// <summary>
/// Required designer variable.
/// </summary>
private System.Componen tModel.Containe r components = null;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeCompo nent();
//
// TODO: Add any constructor code after InitializeCompo nent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Disp ose();
}
}
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 InitializeCompo nent()
{
this.sqlConnect ion1 = new System.Data.Sql Client.SqlConne ction();
this.sqlSelectC ommand1 = new System.Data.Sql Client.SqlComma nd();
this.sqlInsertC ommand1 = new System.Data.Sql Client.SqlComma nd();
this.sqlUpdateC ommand1 = new System.Data.Sql Client.SqlComma nd();
this.sqlDeleteC ommand1 = new System.Data.Sql Client.SqlComma nd();
this.aGamintoja s = new System.Data.Sql Client.SqlDataA dapter();
this.ds_gam1 = new Autocentras2.ds _gam();
this.button1 = new System.Windows. Forms.Button();
((System.Compon entModel.ISuppo rtInitialize)(t his.ds_gam1)).B eginInit();
this.SuspendLay out();
//
// sqlConnection1
//
this.sqlConnect ion1.Connection String = "workstatio n id=DALIUSXP;pac ket
size=4096;user id=sa;data source=\"DALIUS XP\\DALIUSS" +
"QLSERVER\";per sist security info=False;init ial catalog=Autocen trasDB";
//
// sqlSelectComman d1
//
this.sqlSelectC ommand1.Command Text = "SELECT Gamintojas_ID, Gamintojas FROM
TblGamintojas";
this.sqlSelectC ommand1.Connect ion = this.sqlConnect ion1;
//
// sqlInsertComman d1
//
this.sqlInsertC ommand1.Command Text = "INSERT INTO TblGamintojas(G amintojas)
VALUES (@Gamintojas); SELECT Gamintojas_ID," +
" Gamintojas FROM TblGamintojas WHERE (Gamintojas_ID = @@IDENTITY)";
this.sqlInsertC ommand1.Connect ion = this.sqlConnect ion1;
this.sqlInsertC ommand1.Paramet ers.Add(new
System.Data.Sql Client.SqlParam eter("@Gamintoj as",
System.Data.Sql DbType.VarChar, 50, "Gamintojas "));
//
// sqlUpdateComman d1
//
this.sqlUpdateC ommand1.Command Text = @"UPDATE TblGamintojas SET Gamintojas =
@Gamintojas WHERE (Gamintojas_ID = @Original_Gamin tojas_ID) AND (Gamintojas
= @Original_Gamin tojas OR @Original_Gamin tojas IS NULL AND Gamintojas IS
NULL); SELECT Gamintojas_ID, Gamintojas FROM TblGamintojas WHERE
(Gamintojas_ID = @Gamintojas_ID) ";
this.sqlUpdateC ommand1.Connect ion = this.sqlConnect ion1;
this.sqlUpdateC ommand1.Paramet ers.Add(new
System.Data.Sql Client.SqlParam eter("@Gamintoj as",
System.Data.Sql DbType.VarChar, 50, "Gamintojas "));
this.sqlUpdateC ommand1.Paramet ers.Add(new
System.Data.Sql Client.SqlParam eter("@Original _Gamintojas_ID" ,
System.Data.Sql DbType.Int, 4, System.Data.Par ameterDirection .Input, false,
((System.Byte)( 0)), ((System.Byte)( 0)), "Gamintojas_ID" ,
System.Data.Dat aRowVersion.Ori ginal, null));
this.sqlUpdateC ommand1.Paramet ers.Add(new
System.Data.Sql Client.SqlParam eter("@Original _Gamintojas",
System.Data.Sql DbType.VarChar, 50, System.Data.Par ameterDirection .Input,
false, ((System.Byte)( 0)), ((System.Byte)( 0)), "Gamintojas ",
System.Data.Dat aRowVersion.Ori ginal, null));
this.sqlUpdateC ommand1.Paramet ers.Add(new
System.Data.Sql Client.SqlParam eter("@Gamintoj as_ID",
System.Data.Sql DbType.Int, 4, "Gamintojas_ID" ));
//
// sqlDeleteComman d1
//
this.sqlDeleteC ommand1.Command Text = "DELETE FROM TblGamintojas WHERE
(Gamintojas_ID = @Original_Gamin tojas_ID) AND (Ga" +
"mintojas = @Original_Gamin tojas OR @Original_Gamin tojas IS NULL AND
Gamintojas I" +
"S NULL)";
this.sqlDeleteC ommand1.Connect ion = this.sqlConnect ion1;
this.sqlDeleteC ommand1.Paramet ers.Add(new
System.Data.Sql Client.SqlParam eter("@Original _Gamintojas_ID" ,
System.Data.Sql DbType.Int, 4, System.Data.Par ameterDirection .Input, false,
((System.Byte)( 0)), ((System.Byte)( 0)), "Gamintojas_ID" ,
System.Data.Dat aRowVersion.Ori ginal, null));
this.sqlDeleteC ommand1.Paramet ers.Add(new
System.Data.Sql Client.SqlParam eter("@Original _Gamintojas",
System.Data.Sql DbType.VarChar, 50, System.Data.Par ameterDirection .Input,
false, ((System.Byte)( 0)), ((System.Byte)( 0)), "Gamintojas ",
System.Data.Dat aRowVersion.Ori ginal, null));
//
// aGamintojas
//
this.aGamintoja s.DeleteCommand = this.sqlDeleteC ommand1;
this.aGamintoja s.InsertCommand = this.sqlInsertC ommand1;
this.aGamintoja s.SelectCommand = this.sqlSelectC ommand1;
this.aGamintoja s.TableMappings .AddRange(new
System.Data.Com mon.DataTableMa pping[] {
new System.Data.Com mon.DataTableMa pping("Table", "TblGamintojas" , new
System.Data.Com mon.DataColumnM apping[] {
new System.Data.Com mon.DataColumnM apping("Gaminto jas_ID", "Gamintojas_ID" ),
new System.Data.Com mon.DataColumnM apping("Gaminto jas", "Gamintojas")}) });
this.aGamintoja s.UpdateCommand = this.sqlUpdateC ommand1;
//
// ds_gam1
//
this.ds_gam1.Da taSetName = "ds_gam";
this.ds_gam1.Lo cale = new System.Globaliz ation.CultureIn fo("lt-LT");
//
// button1
//
this.button1.Lo cation = new System.Drawing. Point(112, 120);
this.button1.Na me = "button1";
this.button1.Si ze = new System.Drawing. Size(144, 23);
this.button1.Ta bIndex = 0;
this.button1.Te xt = "PildytiDataset ";
this.button1.Cl ick += new System.EventHan dler(this.butto n1_Click);
//
// Form1
//
this.AutoScaleB aseSize = new System.Drawing. Size(5, 13);
this.ClientSize = new System.Drawing. Size(464, 334);
this.Controls.A dd(this.button1 );
this.Name = "Form1";
this.Text = "Form1";
((System.Compon entModel.ISuppo rtInitialize)(t his.ds_gam1)).E ndInit();
this.ResumeLayo ut(false);
}
#endregion
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run (new Form1());
}
private void button1_Click(o bject sender, System.EventArg s e)
{
//THIS DOES NOT WORK !!!!!!! WHY?
aGamintojas.Fil l(ds_gam1);
}
}
}
"Frank Oquendo" <fr****@acadxpi n.com> wrote in message
news:#Q******** ******@TK2MSFTN GP09.phx.gbl...
Auto wrote:
Fill() problem in VS .NET 2003 in Windows application C# with SQL Server
Most likely the error is in your code, which you did not show.
--
There are 10 kinds of people. Those who understand binary and those who
don't.
http://code.acadx.com
(Pull the pin to reply)