首页 \ 问答 \ 为什么使用定义列表(DL,DD,DT)代替HTML表单而不是表格?(Why use definition lists (DL,DD,DT) tags for HTML forms instead of tables?)

为什么使用定义列表(DL,DD,DT)代替HTML表单而不是表格?(Why use definition lists (DL,DD,DT) tags for HTML forms instead of tables?)

最近我遇到了一些例子:

<dl>
  <dt>Full Name:</dt>
  <dd><input type="text" name="fullname"></dd>
  <dt>Email Address:</dt>
  <dd><input type="text" name="email"></dd>
</dl>

做HTML表单。 这是为什么? 使用表有什么优势?


I've come across a few examples recently that do things like:

<dl>
  <dt>Full Name:</dt>
  <dd><input type="text" name="fullname"></dd>
  <dt>Email Address:</dt>
  <dd><input type="text" name="email"></dd>
</dl>

for doing HTML forms. Why is that? What is the advantage over using tables?


原文:https://stackoverflow.com/questions/519234
更新时间:2024-03-17 11:03

最满意答案

在字符串之前使用@时,不需要再次转义反斜杠。 LIKE的占位符是%,而不是*。

所以尝试:

string query = @"SELECT COUNT(*) FROM table WHERE path LIKE '%\\\\server\\dir\\%'";

要避免所有转义,请考虑使用SQL参数。

PS:table是保留关键字。 您不应该为表格命名,这将始终导致问题。


So Ms Access use * as a wildcard like T_D indicated and which is what my valide query use in MS Access. BUT like HansUp indicated C# OleDb API still uses ANSI wild cards.

But small correction even to that answer would be to escape the query in c#. So query returning valid answer is:

string query = "SELECT COUNT(*) FROM Settings WHERE path LIKE '%\\\\server\\dir\\%'";
OR
string query = @"SELECT COUNT(*) FROM Settings WHERE path LIKE '%\\server\dir\%'";
-> returns Count(*) = 3

HansUp also pointed that using ALIKE instead of LIKE % also works in MS Access so that way query is compatible with ANSI wildcard %

So here is my working solution (with command parameters):

string destFolder = @"\\server\\dir\";
string query = "SELECT COUNT(*) FROM Settings WHERE path LIKE @destFolder;";

using (OleDbConnection connection = new OleDbConnection(mdbfile))
{
    using (OleDbCommand command = new OleDbCommand(query, connection))
    {
        command.Parameters.AddWithValue("@destFolder", "%" + destFolder + "%");
        try
        {
            connection.Open();
            if ((int)command.ExecuteScalar() == 3)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        catch (OleDbException ex)
        {
            //handle OleDb error
            return false;
        }
    }
}

相关问答

更多
  • 在字符串之前使用@时,不需要再次转义反斜杠。 LIKE的占位符是%,而不是*。 所以尝试: string query = @"SELECT COUNT(*) FROM table WHERE path LIKE '%\\\\server\\dir\\%'"; 要避免所有转义,请考虑使用SQL参数。 PS:table是保留关键字。 您不应该为表格命名,这将始终导致问题。 So Ms Access use * as a wildcard like T_D indicated and which is what ...
  • 您正在尝试为每个pk_id获取第一条记录(基于Field1 )。 这样的事可能适合你: select p.* from table1 as p where p.field1 = (select max(p2.field1) from table1 as p2 where p2.pk_id = p.pk_id ); You are trying to get the first record (base ...
  • 我强烈建议你只是忘记not in使用子查询。 相反,使用not exists : Select [ID] from table1 as t1 where NOT EXISTS (SELECT 1 FROM table2 as t2 WHERE t2.id = t1.id); 如你所知,当子查询返回NULL时, not in有错误的语义(即行为)。 不要试图使其工作,只需使用NOT EXISTS 。 另外一个好处是,这很容易扩展到多列,并且如果可用的话应该使用索引。 I strongly recommend ...
  • 不要像字符串那样处理日期。 没有例外。 在这里你可以使用: RDATE: DateValue([RENEWAL_DATE]) Don't ever handle dates like strings. No exceptions. Here you can use: RDATE: DateValue([RENEWAL_DATE])
  • 我不确定,但我认为这是你的意图: --Combined Query1&2 in SQL SELECT DISTINCT [TableA].Mat, [TableA].Sg, ISNULL([TableA].Pt, [TableC].Pt) AS Pln, [TableB].[Ptype] INTO #FINAL FROM [TableA] INNER JOIN [TableB] ON [TableA].Sg = [TableB].Sg INNER JOIN [TableC] ...
  • 看看这个引用 ,它表明%本身是通配符,虽然它可能取决于你正在使用的SQL的方言。 如果是这种情况,那么您的LIKE子句将只是LIKE '%'但未经测试。 My query was correct. There was something wrong with the actual spreadsheet. After redoing all from scratch - it worked! SELECT Elen_SalesData_View.ItemCode, Elen_SalesData_View.I ...
  • 您的访问代码 Where Field = Date() Sql Server Where Field = CAST(GETDATE() AS DATE) 函数GETDATE()获取当前的Datetime。 今天和过去7天之间的日期 Where Field BETWEEN CAST(DATEADD(DAY, -7, GETDATE()) AS DATE) AND CAST(GETDATE() AS DATE) 我使用CAST()函数的原因是因为GETDATE( ...
  • 确定...导致类型不匹配是因为tblmt.mtdate不是日期字段或者tblmt.hours不是数字字段而且您的数据不是日期,也不是客户的数字不像'TEST *'。 或者,对于某些客户,mt.date中的NULL为null,而null不能与> =进行比较。 如果你说tblMt.cust不喜欢“TEST *”,你仍会得到错误。 问题可能与数据或您的期望有关,您需要处理它。 什么数据类型是tblMT.hours和tblMt.MtDate? Ok... the type mismatch is caused be ...
  • 我无权访问MS, 但是我会告诉你使用基本的SQL功能在MySql上做到这一点:JOIN + GROUP BY + MAX: SELECT t.Awardee, t.State, t.City, max( t.Year ) as Year FROM table1 t JOIN ( SELECt Awardee, State, City, max( Year ) as Year FROM table1 GROUP BY Awardee, State, City ) x ON x.Awardee = ...
  • 你的意思是你正在尝试运行文本查询,就像在SSMS中一样? 我认为唯一需要转义的是'所以你应该能够选择文本块,并做一个find-replace来替换' with '' 。 注意:如果您是从代码运行它,那么您应该使用参数化查询,纯粹而简单。 You mean you're trying to run a text query, like in SSMS? I think the only thing that needs to be escaped is the ' so you should be able ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)