Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Newbie SQL Server question
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Divers
Thread ID:
00997436
Message ID:
00997453
Vues:
13
Hi Sylvain,

Yes, that is a valid question. I am updating an existing shopping cart product catalog on a daily basis with any modifications made to their pos system. Anyway, the way the shopping cart creates the child tables associated with the product table makes it impossible for me to match and find the correct child to update.

Regarding the transaction, can you take a look at this and tell me what you think?
static public void ExecuteLongTimeSQL(String sql, String DBConnString, int TimeoutSecs)
{
	System.Data.SqlClient.SqlConnection dbconn = new System.Data.SqlClient.SqlConnection();
	dbconn.ConnectionString = DBConnString;
	dbconn.Open();
	SqlCommand cmd = new SqlCommand(sql,dbconn);
	cmd.CommandTimeout = TimeoutSecs;
	cmd.ExecuteNonQuery();
	cmd.Dispose();
	dbconn.Close();
	dbconn.Dispose();
}
Thanks,
Paul

>The records are not marked for deletion like VFP. They are gone as soon as you delete them.
>
>To keep your database consistent in case of failure, you should wrap your delete/insert inside a transaction.
>
>But the real question is: Why don't you just update the records?
>
>>I am using SQL Server for the first time with C#. I have a webservice that manages a products table in SQL Server. This webservice accepts XML and either adds product or updates product. For reasons I won't go into here, for each update I am needing to delete the product record and all related records in other tables and then readd the udpated item in the product table and related tables.
>>
>>Long story short, this webservice is going to be deleting a lot of records in SQL Server. Are they still there marked for deletion like in VFP. If so, how do I remove them?
>>
>>Should I rethink this method of deleting records and re adding for all updates?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform