Bilgisayar Bölümü ASP Kod ve Script Arşivi


Veritabani üzerindeki tüm tabloları, alanları listeler

Yazan :
Can ""FiNaRFiN"" HANHAN

Aiklama :
Belirtilen veritabani zerindeki tm tablolari, alanlari, ierikleri listeler.

Kullanilanlar :
VBScript

Kullanim : Bu kodu herhangi bir dosya adiyla kaydederseniz Microsoft SQL Server zerinde sorunsuz alistirabilirsiniz. Access zerinde denenmemistir.


Kod :
<%
strConn = ""Provider=sqloledb;Data Source=127.0.0.1;Network Library=DBMSSOCN;Initial Catalog=Veritabani;User ID=KullaniciAdi;Password=Sifre;""
Set objConn = Server.CreateObject ( ""ADODB.Connection"" )
objConn.Open strConn

Set RQ = Request.QueryString
Set objRs = Server.CreateObject ( ""ADODB.RecordSet"" )
If Request.QueryString ( ""Tablo"" ) = ""All"" Then
Set objTablolar = ObjConn.Open Schema ( 20 )
Do Until objTablolar.EOF
If objTablolar ( ""TABLE_TYPE"" ) <>""SYSTEM TABLE"" Then
Call FieldTara ( objTablolar ( ""TABLE_NAME"" ) )
End If
objTablolar.Move Next
Loop

REsponse.Write ""</table>""
ElseIf TRIM ( Request.QueryString ( ""Tablo"" ) ) = """" Then
Set objTablolar = ObjConn.Open Schema ( 20 )
Do Until objTablolar.EOF
If objTablolar ( ""TABLE_TYPE"" ) =""TABLE"" Then
Response.Write ""<a href='"" & REquest.ServerVariables ( ""SCRIPT_NAME"" ) & ""?Tablo="" & objTablolar ( ""TABLE_NAME"" ) & ""'>"" & objTablolar ( ""TABLE_NAME"" ) & "" ( "" & Say ( objTablolar ( ""TABLE_NAME"" ) ) & "" ) </a><br>""
End If
objTablolar.Move Next
Loop
Response.Write ""<a href='"" & Request.ServerVariables ( ""SCRIPT_NAME"" ) & ""?Tablo=All'>Hepsini Gster</a>""
ElseIf Request.QueryString ( ""Tablo"" ) <> """" And Request.QueryString ( ""Tablo"" ) <> ""All"" Then
Call FieldTara ( TRIM ( Request.QueryString ( ""Tablo"" ) ) )
End If

Function Say ( strTablo )
strSQL = ""Select COUNT ( * ) FROM "" & strTablo
Set objRs = objConn.Execute ( strSQL )
Say = objRS ( 0 )
Set objRS = Server.CreateObject ( ""ADODB.RecordSet"" )
End Function
Sub FieldTara ( strTablo )
strSQL = ""Select * FROM "" & strTablo
objRs.Open strSQL, objConn, 1, 3
Set objFields = objRs.Fields

iToplam = objFields.Count
Response.Write ""<table align='center' border='1'><tr><th colspan='2'>"" & strTablo & ""</th></tr><tr>""
For Each objField In objFields
Select Case objField.Type
Case 3 strType = ""Otomatik Sayi""
Case 202 strType = ""Metin""
Case 203 strType = ""Not""
Case 11 strType = ""Evet/Hayir""
Case 135 strType = ""Tarih Saat""
End Select

Response.Write ""<td>"" & objField.Name & "" ( ""& strType & "" ) </td>""
' Response.Write objField.Value
Next
' Response.Write ""</table>""
If Not objRs.Eof Then
strIcerik = objRs.GetString ( ,, ""</td><td>"", ""</td></tr><tr><td>"", ""&nbsp;"" )
Response.Write ""</tr><tr><td>"" & strIcerik & ""</td></tr></table>""
End If
objRs.Close
End Sub
%>



"

ASP Kitabı

 

Faydalılar: Altın Fiyatları |Hediye Kolye | pırlanta fiyatları
Ana Sayfa  Sık Kullanılanlara Ekle   admin[at]bilgisayarbolumu.com | © 2006 - 2020 Bilgisayarbolumu.com