本文介绍了分隔符,sql,join,AHHH!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 好的,几天前我在这里发布了关于文字中的撇号问题 字段,我尝试了一些建议,现在我看起来很深刮掉整件事的因为现在我不知道从哪里开始。如果 修复它看起来需要的时间比开始时间长,那么我想我应该让这艘船下沉并游到岸边并重新组合。 这就是我开始的方式。不是最好的方式我很有信心。我是自学成才的,对于那些在大学里这样做的人来说,你已经知道了我将要经历的事情以及所有陷阱和我一直陷入困境。无论如何, 这里是我的烂摊子的总结。 我在编写一行代码之前开始将信息输入Access数据库。 2 表:演出和场所。我想保留地点与演出分开 继续防止db中的冗余信息。这种方式(我认为)这样就更容易了,所以放置就是这样。信息将始终在那里调用 而不是每次重写它,如果有新的东西提供和 机会让用户单独输入信息然后只是重复使用它它是b / b 。我打算欺骗并创建单独的记录集... RS forgigs然后只为地点创建另一个。好吧,我们现在不是很好!现在相当混乱!精氨酸。这里遇到的问题...... 它始于分隔符问题。文本字段中的撇号 对我的数据调用造成严重破坏。我是邪恶的并使用SELECT *所以它 没有出现在sql字符串中还没有。当我试图将记录集中的记录与循环中生成的内容进行匹配时,问题出现了...就像在html中的select标记中循环 记录以生成所有选项一个Dropbox。 问题是撇号,当文件字段中的第一个撇号打到 时,记录会停止写入。所以我尝试使用替换把它们全部变成& acute;最终造成了一个更大的混乱(并且html保持 解释& acute;进入''所以我可以让它们进行网格化)并且在数据库中如此 更多我把糟糕的事情弄得一团糟......追逐火车...... 我确实试图回去并将替换改为'''''而不是& acute; (难以阅读,不是吗)引用2撇号引用。我没有在之前的帖子中了解到b 。到这个时候这个东西是一个混乱...... 我搞砸了Access并尝试使用查找向导链接表格 但是,如你所知,这会产生数字ID,所以我们周围和周围我们 去...... AAHHHH! 那么我开始阅读JOIN',内部',外部',左',右,s。 它们似乎都不是我需要的(而且我只是在处理 sql)...当我看着这个 项目的时钟用完时,我的头在转动。我正在努力!!! 哦,顺便说一句,这就是网站。前端完成了。这是用户管理员的后端,这是造成所有问题的原因。 http://thehalftonhorns.com 所以这就是我该做什么... 1)。有2个表,演出和地方 2)。能够在记录集中呼叫和更新 如果你想指向我的方向,这里有我手头的书籍清单 你知道... 开始Active Server Pages 3.0(Wrox) 开始ASP数据库(Wrox) 开始Javascript(Wrox) HTML完整 MSDN Library -Visual Studio 6.0(磁盘) 我真的希望有人可以提供帮助。我正在驾驶我的妻子和孩子坚果 锁定在这个房间里好几天变成怪物爸爸。 谢谢!!!! JohnOk, I posted in here a few days ago about a problem with apostrophes in textfields and I tried a few of the suggestions and now I''m in so deep I lookingat scraping the whole thing because now I don''t know where to begin. Iffixing it looks like it will take longer than starting over then I suppose Ishould let this ship sink and swim to shore and regroup.Here''s the way I started. Not the best way I''m sure. I''m self taught sofor those of you that did this in college you have have an idea of what I''mgoing through and all the pitfalls and chasms I keep falling into. Anyway,here''s the summary of my mess.I started entering info into an Access db before I wrote a line of code. 2tables: gigs and places. I wanted to keep "places" separate from "gigs" tokeep prevent redundant info in the db. This way (I thought) it would beeasier this way so the "places" info would always be there to call oninstead rewriting it everytime and if something new came up to provide andopportunity for the user to enter the info separately then just reuse it asit came up. I was going to "cheat" and just create separate recordsets...anRS for "gigs" then just create another for "places". WELL don''t we havequite a mess now!! Arg. Here the problems I''ve run into...It started with the delimiter problems. The apostrophes in text fieldswreaked havoc on my data calls. I''ve been evil and using "SELECT *" so ithasn''t come up in sql strings "yet". The problems came when I tried tomatch records in recordsets to something generated in loops...like loopingrecords in a select tag in html to produce all the options in a dropbox.The problem was with apostrophes the record would stop writing when it hitthat first apostrophe in the text field. SO I tried using "Replace" to turnthem all into ´ that ended up creating a bigger mess (and html keptinterpreting ´ into '' so I could get them to mesh) and in the DB sothe more I mess with the worse things got...chasing the train as it were...I did try to go back and change the Replace to "''''" rather than "´"(hard to read, ain''t it) thats quote 2 apostrophes quote. I didn''tunderstand that in prior posts until later. By this time this thing is amess......I messed with Access and tried using the lookup wizard to link the tablesbut, as you know, that produces numeric ID''s so around and around wego.....AAHHHH!So then I start reading up on JOIN''s, inner''s, outer''s, left''s ,right,s.None of them seem to be what I need (and I''m just getting a handle onsql)...and my head is spinning while I watch the clock run out on thisproject. I AM GOING NUTS!!!Oh, and this is the site by the way. the front end is done. It''s thebackend, the users admin side, that''s causing all the problems. http://thehalftonhorns.comSo this is what I what to do...1). have 2 tables, "gigs" and "places"2). be able to call on and update both in recordsetsHere''s a list of books I have on hand if you want to point me in a directionyou know of...Beginning Active Server Pages 3.0 (Wrox)Beginning ASP Databases (Wrox)Beginning Javascript (Wrox)HTML CompleteMSDN Library -Visual Studio 6.0 (disk)I really hope someone can help on this. I''m driving my wife and kids nutslocked in this room for days turning into "monster daddy".Thanks!!!!John推荐答案 来决定是否要分隔数据,查看 字段的数据类型 - 不是数据。 1.如果它是数字字段,则必须提供数字数据,其中 表示你​​不能通过在它周围加上引号来划分数据。 2.如果它是字符/文本字段,那么你必须通过 用单引号或双引号分隔数据。如果数据 包含文字引号,则必须通过加倍来转义它们。这意味着 如果你的字符串分隔符使用单引号(撇号),并且 数据包含撇号,那么你必须用撇号取代撇号两个撇号,如下所示: 更新tbl set textfield =''O''''Malley'' 在Access中,你可以使用双引号你的分隔符,所以这将工作 以及: 更新tbl set textfield =" O''Malley" 注意:你不要当你使用 双引号作为分隔符时,不得不逃避O''Malley的撇号。但是,在将此语句分配给变量时,您需要转义双 引号: sSQL ="更新tbl set textfield ="" O'' Malley""" 所以大多数人会使用单引号并逃避撇号: sName =" O''Malley" sSQL ="更新tbl set textfield =''" &安培;替换(sName,"''","''''")& "''" response.write sSQL 数据库。由于您使用的是Access,因此必须使用 哈希标记(#)来分隔数据。此外,您必须以美国格式提供数据 (m / d / yyyy)或ISO(yyyy-mm-dd),后者更多 推荐。 4.最后,如果你使用LIKE,你需要注意你必须使用% 和_作为通配符,而不是*和?这是真的无论你使用什么数据库 然后,当你认为你做对了它仍然无效时, response.write它来查看连接的结果。如果你已经正确地完成了它,那么你将有一个声明,你可以从 浏览器窗口复制并粘贴到Access Query Builder的SQL视图中运行没有修改(除非你需要用Jet 通配符替换通配符)。 这里有更多: http://groups.google.com/groups?hl=e...tngp13.phx.gbl http://groups.google.com/groups?hl=e...TNGP11.phx.gbl http :?//www.google.com/groups塞尔姆= EE .. 。& output = gplain http://www.google.com/groups?hl=en&l...TNGP12。 phx.gbl Bob Barrows - Microsoft MVP - ASP / ASP .NET 请回复新闻组。我的From 标题中列出的电子邮件帐户是我的垃圾邮件陷阱,因此我不经常检查它。通过发布到新闻组,您将获得更快的回复。To decide whether or not to delimit the data, look at the datatype of theFIELD - NOT THE DATA.1. If it''s a numeric field, you must supply it with numeric data, whichmeans you MUST NOT delimit the data by putting quotes around it.2. If it''s a character/text field, then you must supply string data bydelimiting the data either with single or double quotes. If the datacontains literal quotes, you must escape them by doubling them. This meansthat if you use single quotes (apostrophes) for your string delimiters, andthe data contains an apostrophe, then you must replace the apostrophe withtwo apostrophes, like this:Update tbl set textfield = ''O''''Malley''In Access, you can use double quotes for your delimiters, so this will workas well:Update tbl set textfield = "O''Malley"Note: you don''t have to escape the apostrophe in O''Malley when you usedouble quotes as the delimiter. However, you will need to escape the doublequotes when assigning this statement to a variable:sSQL = "Update tbl set textfield = ""O''Malley"""So most people will use the single quotes and escape the apostrophe:sName = "O''Malley"sSQL = "Update tbl set textfield = ''" & Replace(sName,"''","''''") & "''"response.write sSQL3. If it''s a date/Time field, then the delimiters depend on the type ofdatabase. Since you are using Access, then you must delimit the data withhash marks (#). Additionally, you must supply the data in US format(m/d/yyyy) or in ISO (yyyy-mm-dd), with the latter being the morerecommended.4.Lastly, if you are using LIKE, you need to be aware that you must use %and _ as the wildcards, not * and ?. This is true no matter what databaseyou are usingAnd then, when you think you have it right and it still does not work,response.write it to see the result of your concatenation. If you''ve done itcorrectly, you will have a statement that you can copy and paste from thebrowser window into the SQL View of an Access Query Builder and run withoutmodification (unless you need to replace the wildcards with the Jetwildcards).Here''s more: http://groups.google.com/groups?hl=e...tngp13.phx.gbl http://groups.google.com/groups?hl=e...TNGP11.phx.gbl http://www.google.com/groups?selm=eE...&output=gplain http://www.google.com/groups?hl=en&l...TNGP12.phx.gblBob Barrows--Microsoft MVP -- ASP/ASP.NETPlease reply to the newsgroup. The email account listed in my Fromheader is my spam trap, so I don''t check it very often. You will get aquicker response by posting to the newsgroup. 我认为建议您使用单引号,这样 如果/当你将它从Access移动到SQL时,你不必进入并且 重写这么多代码。I think it would be recommended that you use single quotes, so thatif/when you move this from Access to SQL, you won''t have to go in andrewrite so much code. 这篇关于分隔符,sql,join,AHHH!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
07-30 03:49