sql-update

how to retrieve the values that contains a part of value in the column

我是研究僧i 提交于 2019-12-25 19:37:52
问题 Suppose I have a column lastName and I have the data as kumar yadav kumar shah raghu. kumar Now I want to write a SQL query that to get the values whose last name contains kumar. 回答1: Use the like operator select * from tablename where lastname like '%kumar%' 来源: https://stackoverflow.com/questions/55862588/how-to-retrieve-the-values-that-contains-a-part-of-value-in-the-column

update sql column using a hyperlink in asp.net

孤街浪徒 提交于 2019-12-25 19:02:12
问题 I have an sql datasource inner joined with 2 tables (product table[product quantity column] and customer product table[ProductID,CustomerID,TotalProducts, UpdatedProducts]) Currently i have this code behind using a sql button: using (SqlConnection scn = new SqlConnection("Data Source = 'PAULO'; Initial Catalog=ShoppingCartDB;Integrated Security =True")) { scn.Open(); SqlCommand cmd = new SqlCommand("update o set o.Updatedproduct = p.ProductQuantity - o.Totalproduct from CustomerProducts o

How to update database using PHP variables? [duplicate]

ε祈祈猫儿з 提交于 2019-12-25 19:01:25
问题 This question already has answers here : How to include a PHP variable inside a MySQL statement (11 answers) Closed 12 days ago . $Createdby=$_SESSION['adminlog']; $total =$_POST['total']; $due =$_POST['due']; $date =$_POST['issedate']; $invoiceno =$_POST['invno']; $CmpnyName =$_POST['CmpnyName']; $itemdetails =$_POST['item_details']; $itemname =$_POST['itemname']; $amtpaid =$_POST['paid']; $query = "UPDATE billdata SET Total='$total' Due='$due' WHERE InvoiceNo=$invoiceno"; $result = mysql

Rails: attempting save an existiing row but rails generates sql insert instead of update

给你一囗甜甜゛ 提交于 2019-12-25 18:19:20
问题 The error When I have a new record, I don't have a problem. When I have an existing record I'm trying to update, an exception (see below) is thrown. The following two variants of Rails code both throw the same exception when I have an existing row in my email_addresses table I wish to update: ret = @email_address.update(email_address_id: @email_address.email_address_id) I have also tried ret = @email_address.save and get the same exception. The exception When I have an existing record I wish

ODBC SQL update Statement issue if more than 32,000 characters

孤者浪人 提交于 2019-12-25 14:45:36
问题 Here is the problem: I have one giant string of xml data stored in a (BLOB)field in a table. It holds some strings 70k characters or more at times. I pull it out using an ODBC_Connection. I can import (no problem). I can manipulate the XML and save it back as a string (no problem). I can save the string back into a mySQL field (no problem). The problem comes when i try to save it back to its original field that i pulled it from. If I save the string with less than 32,000 characters, we are

How to delete records from a column which belong to a different data type?

假装没事ソ 提交于 2019-12-25 08:30:36
问题 So I inserted few records in a table manually (without using Stored procedure) and rows were fine under a column " COLMN ". Then I tried to automate it by using dynamic-SQL in stored procedure. Unfortunately I ended up appending rubbish records (entered float in a column which was meant to be Char). How can I delete these selected rubbish records which don't belong? Here is how my table looks like: ...And I want to delete those numeric records (from column " COLMN ") I planned to achieve this

SQL Reformatting table columns

故事扮演 提交于 2019-12-25 07:35:39
问题 I have a table right now which is in a very inconvenient format. Example: Columns: Quarter / ID / Sales 1 / 234 / 50 1 / 258 / 100 2 / 234 / 50 2 / 456 / 125 3 / 258 / 100 3 / 456 / 75 3 / 555 / 100 4 / 555 / 50 This is just an example, there are in reality like 5600 columns. I want to reformat the table so that the example I just showed looks more like: ID / Q1 / Q2 / Q3 / Q4 234/ 50 / 50 / 0 / 0 258/ 100 / 0 / 100 / 0 456/ 0 / 125 / 75 / 0 555/ 0 / 0 / 100 / 50 Is there a way for me to

MySql exception was unhandled - Fatal error encountered during command execution

走远了吗. 提交于 2019-12-25 07:20:07
问题 the problem falls under this button and i get the error here: objcommand.ExecuteNonQuery() Once i press this button, it should update all the records in my mysql database. Here is my code (the exact code works fine for another table): Private Sub btnModify1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnModify1.Click Using objconnection = New MySqlConnection("Server=localhost;database=ba-solutions;user id=root;password=") objconnection.Open() If Len

how to update data from datagridview with sqldatabse in vb.net

你说的曾经没有我的故事 提交于 2019-12-25 06:59:38
问题 i use another form editting data. when i double click the selected row in datagridview it will transfer the data in another form(frmEdit). i use this codes but it seems not working, how can i fix this. please help. Dim queryEdit As String = String.Empty queryEdit = "update dataContactDB set con_Name=@Name, con_Phone=@Phone, Address=@Address, Company=@Company, Gender=@Gender.text where con_Phone=txtPhone.text" Using conn As New SqlConnection(dbFunction.db) Using comm As New SqlCommand With

updating related tables in cake

巧了我就是萌 提交于 2019-12-25 06:58:41
问题 I have this: $this->request->data['Person']['person_id'] = $this->Session->read('insertedPersonID'); $savedPerson = $this->Person->saveAll($this->request->data, array('validate'=>'first')); which updates the selected person row fine however its related tables like PersonColor and PersonParts are not updating, instead inserting new rows. I thought cake automatically updates the related tables as well as long as the id of the main table which is the foreign key for the other two tables are