SQL Database

Trips

Well-known member
Joined
Aug 7, 2010
Messages
2,788
Hi there,

got a simple question i think...i have a database setup in SQL server express. now when i run my application in debug mode and make changes to the dataset in the code; those arent reflected all the way down to the SQL database. but when i stop the application
and re-run it in debug mode the data that i had added in the first run still shows. So it is storing it in memory somewhere. However when i shutdown VS2010 and restart it, and then run the application in debug mode again, it doesnt have the information that
was previously added. So in effect all my additions are not being mirrored into the SQL database. im running SQL server express 2008. here is a code snippet that shows the save sequence to the SQL database....


<div style="color:Black;background-color:White; <pre>
SqlCommandBuilder cd;
cd = <span style="color:Blue; new SqlCommandBuilder(sqlda_Wrk);
DataRow dRow = ds1.Tables[<span style="color:#A31515; "Workers"].NewRow();

dRow[1] = FirstName.Text;
dRow[2] = LastName.Text;
dRow[3] = Jobtitle.Text;

ds1.Tables[<span style="color:#A31515; "Workers"].Rows.Add(dRow);

++MaxRows; inc = MaxRows - 1;

sqlda_Wrk.Update(ds1, <span style="color:#A31515; "Workers");
[/code]

and the connection string is as follows...

<div style="color:Black;background-color:White; <pre>
sqlCon_Wrk = <span style="color:Blue; new SqlConnection();
sqlCon_Wrk.ConnectionString = <span style="color:#A31515; "Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\MyWorkers.mdf;Integrated Security=True;User Instance=True";
[/code]

any idea why this is happening??


View the full article
 
Back
Top