ISBN

编程入门 行业动态 更新时间:2024-10-28 09:14:16
本文介绍了ISBN - > bookdata查找填写数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

好吧,我想数据库一个​​小型图书馆。

Ok, I wanting to database a small library.

我只有与数据库经验有限,并没有从一个网络服务器查询。

I've only had limited experience with databases, and none with querying from a webserver.

我将要检索像标题信息,发布者,也许作者,描述我能想到这个dooing的最简单的方法是通过ISBN看着他们。

I'm going to want to retrieve information like title, Publisher, maybe author, description the simplest way I can think of dooing this is looking them up via the ISBN.

我遇到isbndb之前,但访问它的API似乎相当复杂的。

I've come across isbndb before, but the API for accessing it seems rather complex.

我不知道我应该如何去这样做。

I'm wondering how I should go about doing this.

推荐答案

最近,我不得不这样做正是这一点,因为我们的索引我们的图书馆为保险起见。下面是VBA类我砍死在一起的code:

I recently had to do exactly this as we indexed our library for insurance purposes. Below is the code of the vba class I hacked together:

Option Compare Database dim BookTitle As String dim BookTitleLong As String dim BookAuthorsText As String dim BookPublisherText As String dim BookSummary As String dim BookNotes As String dim accessKey As String Private Sub Class_Initialize() 'Your isbnDB access key' accessKey = "PUT ACCESSKEY HERE" End Sub Property Get Title() As String Title = BookTitle End Property Property Get TitleLong() As String TitleLong = BookTitleLong End Property Property Get AuthorsText() As String AuthorsText = BookAuthorsText End Property Property Get PublisherText() As String PublisherText = BookPublisherText End Property Property Get Summary() As String Summary = BookSummary End Property Property Get Notes() As String Notes = BookNotes End Property Public Function Lookup(isbn As String) As Boolean Lookup = False Dim xmlhttp Set xmlhttp = CreateObject("MSXML2.xmlhttp") xmlhttp.Open "GET", "isbndb/api/books.xml?access_key=" & accessKey & "&results=texts&index1=isbn&value1=" & isbn, False xmlhttp.send 'Debug.Print "Response: " & xmlhttp.responseXML.XML' Dim xmldoc Set xmldoc = CreateObject("Microsoft.XMLDOM") xmldoc.async = False 'Note: the ResponseXml property parses the server's response, responsetext doesn't xmldoc.loadXML (xmlhttp.responseXML.XML) If (xmldoc.selectSingleNode("//BookList").getAttribute("total_results") = 0) Then MsgBox "Invalid ISBN or not in database" Exit Function End If If (xmldoc.selectSingleNode("//BookList").getAttribute("total_results") > 1) Then MsgBox "Caution, got more than one result!" Exit Function End If BookTitle = xmldoc.selectSingleNode("//BookData/Title").Text BookTitleLong = xmldoc.selectSingleNode("//BookData/TitleLong").Text BookAuthorsText = xmldoc.selectSingleNode("//BookData/AuthorsText").Text BookPublisherText = xmldoc.selectSingleNode("//BookData/PublisherText").Text BookNotes = xmldoc.selectSingleNode("//BookData/Notes").Text BookSummary = xmldoc.selectSingleNode("//BookData/Summary").Text Lookup = True End Function

获取API密钥,粘贴上述code(与你的密钥)到VBA编辑器(插入 - >类模块)的新类模块并命名模块ISBN。您还需要在VBA编辑器添加引用微软XML(工具 - >参考)

Get an API key, paste the above code (with your key) into a new class module in the VBA editor (Insert->Class Module) and name the module "isbn". You also need to add a reference to "Microsoft XML" in the VBA editor (Tools->References)

您可以测试它的工作原理与下面的code段正常的VBA模块中:

You can test it works with the code snippet below in a normal vba module:

Public Function testlookup() Dim book Set book = New isbn book.Lookup ("0007102968") Debug.Print book.Title Debug.Print book.PublisherText End Function

然后只需键入testlookup进入即时窗口(查看 - >立即窗口)。你应该看到的响应:

Then just type "testlookup" into the immediate window (View->Immediate Window). You should see a response of:

The Times book of quotations [Glasgow] : Times Books : 2000.

isbnDB可以返回比我在上面的类收集数据越多,在这里阅读API参考:的http:/ /isbndb/docs/api/ 以及定制类您的需求。

isbnDB can return more than the data I collect in the above class, read the API reference here: isbndb/docs/api/ and tailor the class to your needs.

我发现这篇文章在解释如何使用XMLHTTP来自内部的访问非常有帮助: www.15seconds/issue/991125.htm

I found this article very helpful in explaining how to use xmlhttp from within access: www.15seconds/issue/991125.htm

这是XML DOM方法和XMLHtt prequest对象MSDN的页面也很有用(因为我是一个新用户,我只能上传两个活动链接,你就必须更换点在下面的网址):

The msdn pages on XML DOM Methods and XMLHttpRequest Object were also useful (because I'm a new user I can only post two active links, you'll have to replace the dots in the urls below):

微软MSDN COM / EN-US /库/ ms757828(V = VS.85)的.aspx

msdn microsoft com/en-us/library/ms757828(v=VS.85).aspx

微软MSDN COM / EN-US /库/ ms535874(V = vs.85)的.aspx

msdn microsoft com/en-us/library/ms535874(v=vs.85).aspx

更多推荐

ISBN

本文发布于:2023-11-06 16:23:58,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1564205.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:ISBN

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!