in Eski Blog Yazılarım

Access Web Paylaşımı

Access veritabanını web üzerinden sorgulamaya yarayan ufak bir ASP scritp’i.

<%@ EnableSessionState=False %>
<% Response.ContentType = "text/xml" %>
<?xml version="1.0" encoding="utf-8" ?>
<%
	dim ConnectionString,SqlQuery	
	dim UserId,UserPassword	
	ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="& Server.MapPath("/xml/db.mdb") & ";"	
	SqlQuery = TRIM(Request.Form("q"))
	
	set Conn = Server.CreateObject("ADODB.Connection")
	Conn.Open ConnectionString,UserId,UserPassword		
	Response.Write "<bilgi>"& vbCrlf
		
	set Rs = Server.CreateObject("ADODB.Recordset")
	Rs.Open SqlQuery,Conn,1,2
		if NOT Rs.EOF Then			
			do while NOT Rs.EOF
			Response.Write "<kayitlar>"& vbCrlf
				for each Alan in Rs.Fields				
					Response.Write "<"& Alan.Name &">"& Server.HTMLEncode(Rs(""& Alan.Name &"")) &"</"& Alan.Name &">"& vbCrlf
				next
			Response.Write "</kayitlar>"& vbCrlf
			Rs.MoveNext
			loop			
		End if
	Rs.Close	
	set Rs = Nothing
	
	Response.Write "</bilgi>"& vbCrlf	
	Conn.Close
	set Conn = Nothing
%>

Yorum Bırak

Comment