Veja exemplos de conexão com o banco Access via script ASP.

Windows 2008

Use o exemplo abaixo para realizar uma conexão sem utilizar uma DSN.

 

ConnString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=E:/home/LOGIN_DE_FTP/dados/bancoAccess.accdb;Persist Security Info=False;" Set Conexao = Server.CreateObject("ADODB.Connection") Conexao.Open ConnString Set Registros = Server.CreateObject("ADODB.Recordset") Registros.Open "Clientes", Conexao

Note acima que Data Source=E:/home/LOGIN_DE_FTP/dados/bancoAccess.accdb; representa o caminho de seu site dentro do servidor, que está sob o diretório e:/home/LOGIN_DE_FTP .

O diretório será: e:/home/LOGIN_DE_FTP/dados

Windows 2012

No ambiente Windows 2012 o driver utilizado é o mesmo, porém o caminho físico setado é diferente, neste caso o caminho a ser utilizado deve ter sempre o formato:

//windows-pd-0001.fs.locaweb.com.br/WNFS-0001/Loginftp/CaminhodoBanco

Veja um exemplo utilizando este caminho:

 

<%  'Declarando variáveis Dim adoCon, strCon   'Conectando com o banco strCon = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=//windows-pd-0001.fs.locaweb.com.br/WNFS-0001/Loginftp/Dados/NomedoBanco"   'Criando objeto Set adoCon = Server.CreateObject("ADODB.Connection")   'Abrindo conexão adoCon.Open strCon   '##Tratamento de erro. Caso ocorra problemas na conexão, exibe esta informação e apresenta detalhes. If Err.Number <> 0 Then     response.write "<b><font color='red'> Falha na conexão !</font></b>"     response.write "<BR><BR>"     response.write "<b>Erro.Description:</b> " & Err.Description & "<br>"     response.write "<b>Erro.Number:</b> " & Err.Number & "<br>"     response.write "<b>Erro.Source:</b> " & Err.Source & "<br>" Else    '##Caso a conexão seja bem sucedida, mostra mensagem de confirmação.    response.write "<b><font color='blue'> Conexão OK !</font>" End If   'Fechando conexão adoCon.Close   Set adoCon = Nothing %>

 

Sempre deve-se colocar os bancos de dados access dentro da pasta dados, pois ela não está exposta na web, garantindo assim a segurança do conteúdo contra downloads diretos.

Fechando a conexão

Com o comando Registros.Open a conexão foi criada. Você pode fechá-la com os seguintes comandos:

 Registros.Close Set Registros = Nothing

 

Esse artigo ajudou você?

55 respostas para “Access em ASP”

  1. Sour Diesel Feminized Cannabis Seeds

    There is certainly a great deal to know about this subject. I like all of the points you’ve made.

    Responder
  2. Best value Sex Toys Christmas

    I was just searching for this information for a while. After 6 hours of continuous Googleing, at last I got it in your website. I wonder what is the lack of Google strategy that don’t rank this kind of informative sites in top of the list. Normally the top sites are full of garbage.

    Responder
  3. Tiffanie Tayo

    Having read this I believed it was very informative. I appreciate you finding the time and effort to put judi bola terampil this short article together. I once again find myself spending a lot of time both reading and commenting

    Responder
  4. free horror

    I used to be able to find good advice from your blog articles.

    Responder
  5. a fantastic read legal-news-central.com

    I’m still learning from you, but I’m making my way to the top as well. I definitely enjoy reading everything that is written on your site.Keep the stories coming. I loved it!

    Responder
  6. shoes

    I really like it whenever people get together and share thoughts. Great blog, continue the good work.

    Responder
  7. Emmett Phearsdorf

    Salutation, maybe this is not on theme but anyway, I have been reading about your site and it looks truly tidy. impassioned about your activity. I’m building a new blog and hard put to make it appear great, and provide really good content. I have revealed much on your site and I look forward to more updates and will be coming back.

    Responder
  8. Sol Smillie

    That very first offered me personally on this viewpoint to deal with something that gives a crucial description respecting ?

    Responder
  9. Pest Control Sean

    If you are trying to find for the best extreminator company, look no further. These guys rock! The absolute best out there.

    Responder
  10. Pretty Gaming

    I must thank you for the efforts you’ve put in writing this website. I am hoping to check out the same high-grade content by you later on as well. In truth, your creative writing abilities has motivated me to get my very own website now 😉

    Responder
  11. Korey Strawhorn

    We so appreciate your blog post. You’ll find hundreds of approaches we could put it to good use while having no effort with time and resources. Thank you very much with regard to helping make the post give light to many questions we have got before now.

    Responder
  12. Jim Anderson

    Hey! I loved your blog post. Keep writing stuff like this one. I’ll return to see more articles like these. It was very original. Thanks again!

    Responder
  13. Last mile delivery

    I have been browsing online more than three hours these days, but I never found any interesting article like yours. It is pretty worth enough for me. In my view, if all site owners and bloggers made good content as you did, the web will likely be a lot more helpful than ever before. “Truth is not determined by majority vote.” by Doug Gwyn.

    Responder
  14. Shaun Gondola

    I love blogging and i also can tell that you additionally really like blogging.

    Responder
  15. 슬롯 머신

    Best view i have ever seen !

    Responder
  16. Guy Ovando

    I precisely wished to appreciate you once again. I’m not certain the things I would’ve handled without the entire solutions shown by you relating to that area of interest. This has been a very terrifying concern for me, nevertheless discovering a new specialised technique you solved the issue took me to leap with joy. I’m grateful for this advice as well as wish you know what a great job that you’re getting into educating people via your webblog. I’m certain you have never met any of us.

    Responder
  17. Desert camel Ersatzteile zu verkaufen

    Some genuinely good posts on this website, thank you for contribution. “When he has ceased to hear the many, he may discern the One – the inner sound which kills the outer.” by H Hahn Blavatsky.

    Responder
  18. OXFORD Accesorios en venta

    I have read some good stuff here. Definitely worth bookmarking for revisiting. I surprise how much effort you put to make such a magnificent informative website.

    Responder
  19. Source

    I just want to say I am just beginner to blogging and site-building and absolutely enjoyed this blog site. Probably I’m want to bookmark your website . You really come with superb posts. With thanks for sharing with us your web-site.

    Responder
  20. plumbing companies click to read

    I’ve been browsing online more than three hours today, yet I never found any interesting article like yours. It is pretty worth enough for me. In my view, if all website owners and bloggers made good content as you did, the net will be a lot more useful than ever before.

    Responder
  21. best plumbing you could try these out

    I will immediately take hold of your rss as I can not to find your email subscription hyperlink or newsletter service. Do you have any? Please allow me know so that I could subscribe. Thanks.

    Responder
  22. 마사지구인구직

    You’re so amazing. Oh my Jesus. The almighty bless you.

    Responder
  23. 슬롯

    Best view i have ever seen !

    Responder
  24. Groundbreaking Report on VitalFlow for Prostate

    There is certainly a lot to learn about this subject. I really like all of the points you have made.

    Responder
  25. cool home renovation ideas

    I am writing to make you be aware of of the fine experience my friend’s princess had going through your webblog. She realized several details, which include what it is like to have a great helping nature to let folks without difficulty completely grasp some problematic subject areas. You truly did more than people’s expectations. Thank you for supplying these precious, trustworthy, educational and in addition unique thoughts on this topic to Tanya.

    Responder
  26. Get More Information

    I’ve read some good stuff here. Definitely value bookmarking for revisiting. I wonder how so much attempt you put to make this kind of excellent informative website.

    Responder
  27. porno

    I really appreciate this post. I’ve been looking all over for this! Thank goodness I found it on Bing. You have made my day! Thx again!

    Responder
  28. pool table relocation

    Normally I don’t learn post on blogs, but I wish to say that this write-up very compelled me to try and do it! Your writing style has been amazed me. Thank you, very nice article.

    Responder
  29. White glove delivery

    I have seen that costs for online degree professionals tend to be an excellent value. Like a full College Degree in Communication with the University of Phoenix Online consists of 60 credits from $515/credit or $30,900. Also American Intercontinental University Online comes with a Bachelors of Business Administration with a entire program element of 180 units and a worth of $30,560. Online studying has made having your education much simpler because you can easily earn your current degree from the comfort in your home and when you finish working. Thanks for all other tips I have certainly learned through your site.

    Responder
  30. renovation on a budget

    Valuable info. Lucky me I found your website by accident, and I am shocked why this accident did not happened earlier! I bookmarked it.

    Responder
  31. p's of digital marketing

    I have read a few good stuff here. Definitely worth bookmarking for revisiting. I surprise how much effort you put to make such a excellent informative website.

    Responder
  32. my link

    I simply want to say I am just beginner to blogging and site-building and seriously liked this website. Very likely I’m planning to bookmark your blog . You surely have tremendous articles and reviews. Thanks for sharing with us your blog site.

    Responder
  33. roadside assistance

    fantastic points altogether, you simply won a new reader. What may you recommend about your put up that you just made a few days in the past? Any certain?

    Responder
  34. Learn More

    I wanted to compose a simple comment in order to appreciate you for these great tips you are giving out on this website. My prolonged internet research has at the end of the day been paid with excellent strategies to share with my neighbours. I ‘d admit that we visitors are undeniably blessed to be in a superb place with many awesome individuals with good guidelines. I feel rather blessed to have discovered your web site and look forward to so many more entertaining moments reading here. Thanks again for all the details.

    Responder
  35. alberta car towing

    Wonderful goods from you, man. I have understand your stuff previous to and you’re just extremely excellent. I really like what you’ve acquired here, certainly like what you’re stating and the way in which you say it. You make it enjoyable and you still take care of to keep it sensible. I can not wait to read far more from you. This is really a tremendous site.

    Responder
  36. fmovies

    Thanks for helping out, wonderful info. “If at first you don’t succeed, find out if the loser gets anything.” by Bill Lyon.

    Responder
  37. Commercial cleaning company

    I think this is one of the most important information for me. And i’m glad reading your article. But wanna remark on some general things, The site style is ideal, the articles is really nice : D. Good job, cheers

    Responder
  38. my website

    I wish to get across my affection for your generosity for folks that have the need for help on this particular study. Your special commitment to passing the solution throughout became extraordinarily insightful and has continuously empowered professionals like me to attain their objectives. This informative report denotes a whole lot a person like me and especially to my office colleagues. Thanks a ton; from each one of us.

    Responder
  39. Tomi Dragich

    I just want to say I am very new to blogging and site-building and certainly liked you’re blog. More than likely I’m want to bookmark your blog . You really have great articles. Regards for sharing your website.

    Responder

Comente sobre este conteúdo! Escreva o que pensa, complemente, vamos discutir. O conhecimento é livre!