Need help Updating SQL Server Express DB from c# :(


Posted on 16th Feb 2014 07:03 pm by admin

Please can anyone help with:-
1 How to sructure the strSelect statement.
2 How to instruct the cn, da, cb, tb etc to go and get on with it.

Extra info: gl_Dataset.ds is a dataset that is in an object that is created in the forms designer.cs
and is then global to all code on this form. This setup works because I can read and display the data.
colErrByUserID is not PK but all columns in table were selected when gl_Dataset.ds was created.


private void btnSaveAllChangesMadeToAllLogsSoFar_Click(object sender, EventArgs e)
{
string strSelect = "UPDATE INTO dbo.tblQLs WHERE colErrByUserID = '" +
LoginForm.gb_strUserID + "' ";

SqlConnection cn = new SqlConnection(LoginForm.gb_strConnection);
SqlDataAdapter daTblQLs = new SqlDataAdapter(strSelect, LoginForm.gb_strConnection);
SqlCommandBuilder cb = new SqlCommandBuilder(daTblQLs);

cb.GetUpdateCommand();
daTblQLs.Update(gl_Dataset.ds, "tblQLs");

cn.Close();
}

Thank you for your help.

No comments posted yet

Your Answer:

Login to answer
87 Like 34 Dislike
Previous forums Next forums
Other forums

Shuffle Array
Hi,

I am writing a script for a game that needs players to randomly be assigned a target (ano

Varible in trigger - refering to correct schema
Hello

Im having some issues with my trigger.
What I want to do is call opon a differ

Removing Title From database problem
Hi again ! i am having an issue with updating database. When i update any price of a title it remove

Help with looping
I have a comma separated list of colors taken from a database ($ICo) and a directory of images named

php global variable
how can we create global variable so we can use its value in any form.. Please give example to

Deleting a record php
Attempting to setup delete a record page. The below code I put together doesn't seem to work.

This must be easy , pulling the last record of the day, every day, from a txt
I have a txt file logging weather data every minutes (so 1 record per minute). I want to extract the

using variables in another page
I have a test database set up on localhost. I have a form that I can type a name into, hit the butto

Whats wrong with my query?
I am trying to get this query to show the appropriate ticked vehicle roof height, unless no boxs are

Set Categories
I am creating a submission form for somebody to come in and submit products. These products are sep

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash