首页
\
问答
\
如何在sql server数据库中使用数据保存datagridview列(How to save datagridview columns with datas in sql server database)
如何在sql server数据库中使用数据保存datagridview列(How to save datagridview columns with datas in sql server database)
场景是....我必须在datagridview中选择一行并将这些数据保存到database.It可以存在任意数量的列。 如何实现这个..
Scenario is.... I have to select a row in datagridview and save those datas to database.It can any number of columns present. how to achieve this..
原文:https://stackoverflow.com/questions/3067369
更新时间:2021-11-27 16:11
最满意答案
删除
IN('46,49')
的引号,以便您的查询如下所示:SELECT c.category_id, c.parent_id, cd.name, cd.description FROM mydb_category c LEFT JOIN mydb_category_description cd ON (c.category_id = cd.category_id) WHERE c.category_id IN (46,59) AND c.status = '1' AND cd.language_id = '1'
有关详细信息,请参阅文档 。 祝你好运!
Remove the quotes in
IN('46,49')
so your query look like this:SELECT c.category_id, c.parent_id, cd.name, cd.description FROM mydb_category c LEFT JOIN mydb_category_description cd ON (c.category_id = cd.category_id) WHERE c.category_id IN (46,59) AND c.status = '1' AND cd.language_id = '1'
Se the documentation for more info. Good luck!
相关问答
更多-
例如,您可以加入另一张桌子 SELECT * FROM menu INNER JOIN order_items ON menu.item_id = order_items.item_id WHERE order_id = 123; 或者只是在应用程序中复制它们。 你不应该真的需要做你想要的东西。 You could join on another table, for example SELECT * FROM menu INNER JOIN order_items ON menu.item_id = o ...
-
用$row.["X"]替换$row.["X"]所有实例 $row是一个数组。 查找访问数组中键的正确方法。 此外,启用错误报告将显示: 注意:在某些行的某个文件中,数组转换为字符串 您正在尝试连接两个数组并打印它们。 (在php> 5.4中, ["X"]是一个包含一个元素的数组) 请参阅此链接以启用错误消息。 这个链接在php数组上。 希望能帮助到你 ;) Replace all instances of $row.["X"] with $row["X"] $row is an array. Lookup ...
-
如果GROUP BY子句不存在,则COUNT()聚合将只返回一行,而MySQL对GROUP BY的存在或内容宽松(在大多数其他RDBMS中,您的查询将失败,并且语法错误)。 既然你有多个列,你应该加入一个子查询来获得每个Files.GUID的计数。 尽管MySQL允许你在没有子查询的GROUP BY Users.GUID情况下更简单,但是你可能无法得到你期望从Users.Name或Users.CreationDate得到的结果。 这种方法更便携: SELECT Users.GUID, Users.N ...
-
从MySQL返回一行(Return One Row from MySQL)[2023-06-25]
添加limit 0,1 : $query = "SELECT name,age FROM people WHERE uid = '2' LIMIT 0,1"; $result = mysql_query($query); $res = mysql_fetch_assoc($result); echo $res["age"]; add limit 0,1 : $query = "SELECT name,age FROM people WHERE uid = '2' LIMIT 0,1"; $result ... -
删除IN('46,49')的引号,以便您的查询如下所示: SELECT c.category_id, c.parent_id, cd.name, cd.description FROM mydb_category c LEFT JOIN mydb_category_description cd ON (c.category_id = cd.category_id) WHERE c.category_id IN (46,59) AND c.st ...
-
您可以使用COALESCE检查ID是否为null ,然后返回0 (或其他任何您想要的东西): select COALESCE(MAX(uid), 0) from users 您可以简单地使用MAX来获取最后插入的ID ,如果它将为null,则查询将返回0 。 但我建议你在表的ID上使用Auto Increment 。 因为您不知道其他人是否也将该lastID + 1值作为ID。 You can use COALESCE to check if the ID is null, then return 0 ( ...
-
在C中关闭连接后,从函数中的MySQL查询返回结果(Return a result from a MySQL query in a function after closing connection in C)[2021-09-07]
cast retvalue = (int)row[0]错误。 它将结果的地址(转换为int)放在retvalue 。 row[0]是一个char* ,所以你应该使用retvalue=atoi(row[0]) 。 The cast retvalue = (int)row[0] is wrong. It puts the address of the result (converted to int) in retvalue. row[0] is a char*, so you should use retva ... -
请注意,您正在读取while之前的第一行: // get rid of this line of code //$row = mysql_fetch_array($result); $data = array(); while($row = mysql_fetch_array($result)) { $data[] = array($row['house'],$row['housePoints'],$row['ID']); } Notice that you are reading the fir ...
-
更新成功时, mysql_query返回true (即,无错误地运行,无论它执行或未更新多少行)。 如果您想要实际更新的行数,则需要调用mysql_affected_rows : $sql = "UPDATE test_table SET lastname='ram' where id=1"; if (mysql_query($sql)) { $result = mysql_affected_rows(); echo $result; } mysql_query returns true ...
-
试试这样吧 while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo ""; } Try like this while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo "