Problem in SqlExpress
-
I Add a database to my program in this way : Right Click on my program in Solution ->Add->Add Existing Item -> Select DB connectionString : Data Source=.\\SQLEXPRESS;AttachDbFilename="+Directory.GetCurrentDirectory()+"\\TMC.mdf;Integrated Security=True;User Instance=True when I select everything is ok problem : when I insert,delete,update nothing change in DataBase why?
-
I Add a database to my program in this way : Right Click on my program in Solution ->Add->Add Existing Item -> Select DB connectionString : Data Source=.\\SQLEXPRESS;AttachDbFilename="+Directory.GetCurrentDirectory()+"\\TMC.mdf;Integrated Security=True;User Instance=True when I select everything is ok problem : when I insert,delete,update nothing change in DataBase why?
SajjadZare wrote:
when I insert,delete,update nothing change in DataBase
Are you sure? Ifyou are looking at the data in your application you need to refresh your datasource to see changes. Look directly in the database to see if it has been updated.
Bob Ashfield Consultants Ltd Proud to be a Code Project MVP
-
I Add a database to my program in this way : Right Click on my program in Solution ->Add->Add Existing Item -> Select DB connectionString : Data Source=.\\SQLEXPRESS;AttachDbFilename="+Directory.GetCurrentDirectory()+"\\TMC.mdf;Integrated Security=True;User Instance=True when I select everything is ok problem : when I insert,delete,update nothing change in DataBase why?
check the exception that's being generated.
.45 ACP - because shooting twice is just silly
-----
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001 -
SajjadZare wrote:
when I insert,delete,update nothing change in DataBase
Are you sure? Ifyou are looking at the data in your application you need to refresh your datasource to see changes. Look directly in the database to see if it has been updated.
Bob Ashfield Consultants Ltd Proud to be a Code Project MVP
It's update at first but when I close the program and run it the record that I inserted dosen't exist
-
It's update at first but when I close the program and run it the record that I inserted dosen't exist
Did you use
commit
in your sql?.45 ACP - because shooting twice is just silly
-----
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001 -
I Add a database to my program in this way : Right Click on my program in Solution ->Add->Add Existing Item -> Select DB connectionString : Data Source=.\\SQLEXPRESS;AttachDbFilename="+Directory.GetCurrentDirectory()+"\\TMC.mdf;Integrated Security=True;User Instance=True when I select everything is ok problem : when I insert,delete,update nothing change in DataBase why?
How do you insert, delete and update?
See my article about Windows 7 Taskbar timer here on CodeProject
-
I Add a database to my program in this way : Right Click on my program in Solution ->Add->Add Existing Item -> Select DB connectionString : Data Source=.\\SQLEXPRESS;AttachDbFilename="+Directory.GetCurrentDirectory()+"\\TMC.mdf;Integrated Security=True;User Instance=True when I select everything is ok problem : when I insert,delete,update nothing change in DataBase why?
As you added this database file to your project did you maybe select "always copy" on the "copy to output directory" property (I don't know the exact phrase in the english studio for this)? Because this overrides the "modified" database file with the old one (this will be done every time you build your project). If so, try to use the setting "only if newer".
Greetings Covean
-
Did you use
commit
in your sql?.45 ACP - because shooting twice is just silly
-----
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001What's Commit
-
How do you insert, delete and update?
See my article about Windows 7 Taskbar timer here on CodeProject
with procedure and I examined these procedure with other database and these procedure work correctly
-
As you added this database file to your project did you maybe select "always copy" on the "copy to output directory" property (I don't know the exact phrase in the english studio for this)? Because this overrides the "modified" database file with the old one (this will be done every time you build your project). If so, try to use the setting "only if newer".
Greetings Covean
How do you add database to program like this ? can you tell me step by step ?
-
How do you add database to program like this ? can you tell me step by step ?
I would do it like to op wrote. He added the db file <currentdir>\tmc.mdf.
Right Click on my program in Solution ->Add->Add Existing Item -> Select DB connectionString : Data Source=.\\SQLEXPRESS;AttachDbFilename="+Directory.GetCurrentDirectory()+"\\TMC.mdf;Integrated Security=True;User Instance=True
;Greetings Covean
-
What's Commit
It's a sql command that makes db changes (to tables) permanent. Learn how to use google.
.45 ACP - because shooting twice is just silly
-----
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001 -
I would do it like to op wrote. He added the db file <currentdir>\tmc.mdf.
Right Click on my program in Solution ->Add->Add Existing Item -> Select DB connectionString : Data Source=.\\SQLEXPRESS;AttachDbFilename="+Directory.GetCurrentDirectory()+"\\TMC.mdf;Integrated Security=True;User Instance=True
;Greetings Covean
so in this way I couldn't find this : <>