insert-update

update in ms access using c#

跟風遠走 提交于 2019-12-02 23:29:39
问题 can someone please help what is wrong with my code? it is a update function and during my debug it executing properly but it is not updating my database. I already search for an answer to for this problem but still it didn't work. i also try to create a new database hoping that it is problem but still no effect. private void update_Click(object sender, EventArgs e) { DataTable dt = new DataTable(); OleDbConnection con = new OleDbConnection(); con.ConnectionString = @"Provider = Microsoft.ACE

How do I Insert or Update (or overwrite) a record using NHibernate?

隐身守侯 提交于 2019-12-02 19:32:38
I need to write a row to the database regardless of whether it already exists or not. Before using NHibernate this was done with a stored procedure. The procedure would attempt an update and if no rows were modified it would fallback to an insert. This worked well because the application doesn't care if the record exists. With NHibernate, the solutions I have found require loading the entity and modifying it, or deleting the entity so the new one can be inserted. The application does have to care if the record already exists. Is there a way around that? Does the Id Matter? Assigned Id The

Is there a way to do an “INSERT…ON DUPLICATE KEY UPDATE” in Zend Framework 1.5?

柔情痞子 提交于 2019-12-02 17:37:12
I would like to use ON DUPLICATE KEY UPDATE in Zend Framework 1.5, is this possible? Example INSERT INTO sometable (...) VALUES (...) ON DUPLICATE KEY UPDATE ... I worked for Zend and specifically worked on Zend_Db quite a bit. No, there is no API support for the ON DUPLICATE KEY UPDATE syntax. For this case, you must simply use query() and form the complete SQL statement yourself. I do not recommend interpolating values into the SQL as harvejs shows. Use query parameters. Edit: You can avoid repeating the parameters by using VALUES() expressions. $sql = "INSERT INTO sometable (id, col2, col3)

I get “Syntax error in UPDATE statement” with OleDB

六月ゝ 毕业季﹏ 提交于 2019-12-02 10:02:30
I am developing an information system that works with a connected data source / MS Access database. The question is kinda cliche but I can't seem to find a proper solution from the similar ones I have come across. Here is my code for the button. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 'myConnection.ConnectionString = connString 'myConnection.Open() If Me.txtConfirmPasscode.Text = Me.txtNewPasscode.Text Then Dim updateCmd As OleDbCommand = New OleDbCommand("UPDATE Users SET Password = @ConfPasscode WHERE [Usernames] = @UsersID"

php mysql update limit

淺唱寂寞╮ 提交于 2019-12-02 07:51:10
问题 I want to update mysql database, where directory = 0 , and just update 5 of records which value 0 to art . for explain: id | directory 1 | fashion 2 | 0 //update here into 'art' 3 | travel 4 | fashion 5 | 0 //update here into 'art' 6 | 0 //update here into 'art' 7 | travel 8 | 0 //update here into 'art' 9 | 0 //update here into 'art' 10 | 0 //this is 6th record, do not update, leave the value as '0'. 11 | fashion Is this update code right? thanks. mysql_query("UPDATE articles SET directory =

Update Existing Access Records from CSV Import , native to MS Access or in VB.NET

倾然丶 夕夏残阳落幕 提交于 2019-12-02 05:15:56
I am the application administrator for a ticketing system at my organization. We're adding a new client, and need to import their customer records into our system. However, we have been denied access to simply grab these records from a direct database connection. We are limited to entering their ticketing system, and running an export of the existing records to a CSV file. In order to make this work with our system, I'm taking these CSV's and entering them into an MS Access database, which our system will read and import/update records on our ticketing system from. However, I cannot find a way

php mysql update limit

ぐ巨炮叔叔 提交于 2019-12-02 03:08:01
I want to update mysql database, where directory = 0 , and just update 5 of records which value 0 to art . for explain: id | directory 1 | fashion 2 | 0 //update here into 'art' 3 | travel 4 | fashion 5 | 0 //update here into 'art' 6 | 0 //update here into 'art' 7 | travel 8 | 0 //update here into 'art' 9 | 0 //update here into 'art' 10 | 0 //this is 6th record, do not update, leave the value as '0'. 11 | fashion Is this update code right? thanks. mysql_query("UPDATE articles SET directory = 'art' WHERE directory ='0' LIMIT 5"); your syntax is fine. i will add an order by clause (to be sure)

Primary key value after insertion of row in SQL Server 2005

老子叫甜甜 提交于 2019-12-02 00:11:00
问题 In SQL Server 2005 I am inserting a row into a table using a stored procedure and I want to fetch the new primary key value just after inserting that row. I am using following approach to get primary key value after insertion row Create Proc Sp_Test @testEmail varchar(20)=null,-- Should be Unique @testName varchar(20)=null -- Should be Unique as begin insert into tableTest (testUserEmail,testUserName)values (@testValue,@testName) select MAX(ID) from tableTest --ID is Primary Key --or select

Primary key value after insertion of row in SQL Server 2005

旧城冷巷雨未停 提交于 2019-12-01 22:18:07
In SQL Server 2005 I am inserting a row into a table using a stored procedure and I want to fetch the new primary key value just after inserting that row. I am using following approach to get primary key value after insertion row Create Proc Sp_Test @testEmail varchar(20)=null,-- Should be Unique @testName varchar(20)=null -- Should be Unique as begin insert into tableTest (testUserEmail,testUserName)values (@testValue,@testName) select MAX(ID) from tableTest --ID is Primary Key --or select ID from tableTest where testUserEmail =@testValue and testUserName = @testName --or select SCOPE

PHP PDO simple insert or update function

断了今生、忘了曾经 提交于 2019-12-01 17:39:27
In trying to create a simple PHP PDO update function that if the field is not found would insert it, I created this little snippet. function updateorcreate($table,$name,$value){ global $sodb; $pro = $sodb->prepare("UPDATE `$table` SET value = :value WHERE field = :name"); if(!$pro){ $pro = $sodb->prepare("INSERT INTO `$table` (field,value) VALUES (:name,:value)"); } $pro->execute(array(':name'=>$name,':value'=>$value)); } It does not detect though if the update function is going to work with if(!$pro); How would we make this one work. You are assigning $pro to the prepare, not the execute