Click here to Skip to main content
15,899,679 members
Home / Discussions / C#
   

C#

 
GeneralRe: Dynamic Classes and Intellisense Pin
leppie25-Nov-04 1:38
leppie25-Nov-04 1:38 
GeneralRe: Dynamic Classes and Intellisense Pin
Heath Stewart25-Nov-04 19:41
protectorHeath Stewart25-Nov-04 19:41 
General[Easy] Remoting Pin
Snowjim24-Nov-04 12:52
Snowjim24-Nov-04 12:52 
GeneralRe: [Easy] Remoting Pin
Snowjim24-Nov-04 22:36
Snowjim24-Nov-04 22:36 
Generalquickest and easiest way to share data (C dll & .net dll) Pin
Anonymous24-Nov-04 11:03
Anonymous24-Nov-04 11:03 
GeneralRe: quickest and easiest way to share data (C dll & .net dll) Pin
Nick Parker24-Nov-04 11:08
protectorNick Parker24-Nov-04 11:08 
GeneralRe: quickest and easiest way to share data (C dll & .net dll) Pin
asaddsada24-Nov-04 11:53
sussasaddsada24-Nov-04 11:53 
Generalweb services update database using dataset Pin
Don Jonathan24-Nov-04 11:00
sussDon Jonathan24-Nov-04 11:00 
Hi.
I have a program write in c# that fills a dataset from a access database and send it to a web services.
This web services has to update the data on a sql server.
The problem is the next every time i run the program this send the dataset to the webservices, but the webservices every time insert the information in a new row.
here is the code if you can help me.

[WebMethod(Description="Metodo para insertar DataSet")]
public string guarda(DataSet source)
{
int rows;
conn.Open();
SqlTransaction transac;
transac = conn.BeginTransaction();

SqlCommand sql_select = new SqlCommand("SELECT ccactual, DescCuenta, CCcpv, CuentaRealCPV, ctaactiva FROM cuentas", conn, transac);
SqlCommand sql_update = new SqlCommand("UPDATE cuentas SET ccactual=@ccactual, DescCuenta=@DescCuenta, CCcpv=@CCcpv, CuentaRealCPV=@CuentaRealCPV, ctaactiva=@ctaactiva WHERE ccactual = @ccactual_b", conn, transac);
SqlCommand sql_insert = new SqlCommand("INSERT INTO cuentas (ccactual, DescCuenta, CCcpv, CuentaRealCPV, ctaactiva) VALUES (@ccactual, @DescCuenta, @CCcpv, @CuentaRealCPV, @ctaactiva)", conn, transac);
SqlCommand sql_delete = new SqlCommand("DELETE FROM cuentas WHERE ccactual = @ccactual_b", conn, transac);
SqlDataAdapter da = new SqlDataAdapter();

da.MissingSchemaAction = MissingSchemaAction.AddWithKey;
da.AcceptChangesDuringFill = false;

da.SelectCommand = sql_select;

da.UpdateCommand = sql_update;
da.UpdateCommand.Parameters.Add("@ccactual", SqlDbType.VarChar, 10, "ccactual");
da.UpdateCommand.Parameters.Add("@DescCuenta", SqlDbType.VarChar, 50, "DescCuenta");
da.UpdateCommand.Parameters.Add("@CCcpv", SqlDbType.Int, 4, "CCcpv");
da.UpdateCommand.Parameters.Add("@CuentaRealCPV", SqlDbType.Int, 4, "CuentaRealCPV");
da.UpdateCommand.Parameters.Add("@ctaactiva", SqlDbType.Int, 4, "ctaactiva");
da.UpdateCommand.Parameters.Add("@ccactual_b", SqlDbType.VarChar, 10, "ccactual");

da.InsertCommand = sql_insert;
da.InsertCommand.Parameters.Add("@ccactual", SqlDbType.VarChar, 10, "ccactual");
da.InsertCommand.Parameters.Add("@DescCuenta", SqlDbType.VarChar, 50, "DescCuenta");
da.InsertCommand.Parameters.Add("@CCcpv", SqlDbType.Int, 4, "CCcpv");
da.InsertCommand.Parameters.Add("@CuentaRealCPV", SqlDbType.Int, 4, "CuentaRealCPV");
da.InsertCommand.Parameters.Add("@ctaactiva", SqlDbType.Int, 4, "ctaactiva");

da.DeleteCommand = sql_delete;
da.DeleteCommand.Parameters.Add("@ccactual_b", SqlDbType.Int, 4, "ccactual");

da.Fill(target,"cuentas");

target.Merge(source,true);
target.Tables["cuentas"].da

rows = da.Update(target,"cuentas");

transac.Commit();
conn.Close();
return rows.ToString();
}

Thanks
GeneralRe: web services update database using dataset Pin
Heath Stewart24-Nov-04 14:40
protectorHeath Stewart24-Nov-04 14:40 
Questiondynamic acces to class variables? Pin
TyronX24-Nov-04 8:25
TyronX24-Nov-04 8:25 
AnswerRe: dynamic acces to class variables? Pin
TyronX24-Nov-04 8:36
TyronX24-Nov-04 8:36 
GeneralRe: dynamic acces to class variables? Pin
DavidNohejl24-Nov-04 14:13
DavidNohejl24-Nov-04 14:13 
AnswerRe: dynamic acces to class variables? Pin
Heath Stewart24-Nov-04 8:55
protectorHeath Stewart24-Nov-04 8:55 
GeneralDoubleClick Event on a Label Pin
mlamb24-Nov-04 7:49
mlamb24-Nov-04 7:49 
GeneralRe: DoubleClick Event on a Label Pin
Heath Stewart24-Nov-04 8:44
protectorHeath Stewart24-Nov-04 8:44 
Generalproblem with GraphicsPath Pin
bernd.salewski24-Nov-04 7:49
bernd.salewski24-Nov-04 7:49 
GeneralRe: problem with GraphicsPath Pin
Heath Stewart24-Nov-04 9:01
protectorHeath Stewart24-Nov-04 9:01 
GeneralRe: problem with GraphicsPath Pin
bernd.salewski24-Nov-04 9:14
bernd.salewski24-Nov-04 9:14 
GeneralRe: problem with GraphicsPath Pin
Heath Stewart24-Nov-04 10:06
protectorHeath Stewart24-Nov-04 10:06 
GeneralRe: problem with GraphicsPath Pin
bernd.salewski24-Nov-04 10:51
bernd.salewski24-Nov-04 10:51 
GeneralI found my mistake!!! Pin
bernd.salewski24-Nov-04 11:50
bernd.salewski24-Nov-04 11:50 
Generalsummations Pin
cma2324-Nov-04 7:18
cma2324-Nov-04 7:18 
GeneralRe: summations Pin
Heath Stewart24-Nov-04 8:45
protectorHeath Stewart24-Nov-04 8:45 
GeneralRe: summations Pin
cma2324-Nov-04 9:16
cma2324-Nov-04 9:16 
GeneralRe: summations Pin
Heath Stewart24-Nov-04 10:09
protectorHeath Stewart24-Nov-04 10:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.