Sunday, November 9, 2014

Classic asp database connection

<!DOCTYPE html>
<head>
    <title></title>
</head>
<body>
    <%
        'Dim cnn
'Set cnn = Server.CreateObject("ADODB.Connection")
'cnn.open "PROVIDER=SQLOLEDB;DATA SOURCE=SHIVALISAANVI;UID=ituser;PWD=123456;DATABASE=AdventureWorks2008R2 "
%>
        <%

'Dim conn
'Set conn = Server.CreateObject("ADODB.Connection")

'conn.Open "Provider=SQLOLEDB; Data Source = (SHIVALISAANVI); Initial Catalog = AdventureWorks2008R2; User Id = ituser; Password=123456"

'If conn.errors.count = 0 Then   
'   Response.Write "Connected OK"
'End If


      
        %>
    <% 
'declare the variables 
Dim Connection
Dim Recordset
Dim SQL

'declare the SQL statement that will query the database
SQL = "SELECT TOP 10 *   FROM [AdventureWorks2008R2].[Person].[Person]"

'create an instance of the ADO connection and recordset objects
Set Connection = Server.CreateObject("ADODB.Connection")
Set Recordset = Server.CreateObject("ADODB.Recordset")

'open the connection to the database
Connection.Open  "PROVIDER=SQLOLEDB;DATA SOURCE=SHIVALISAANVI;UID=ituser;PWD=123456;DATABASE=AdventureWorks2008R2 "


'Open the recordset object executing the SQL statement and return records 
Recordset.Open SQL,Connection

'first of all determine whether there are any records 
If Recordset.EOF Then 
Response.Write("No records returned.") 
Else 
'if there are records then loop through the fields 
Do While NOT Recordset.Eof   
Response.write Recordset("FirstName") &"  "
Response.write Recordset("MiddleName")&" "
Response.write Recordset("LastName")&" "
Response.write "<br>"    
Recordset.MoveNext     
Loop
End If

'close the connection and recordset objects to free up resources
Recordset.Close
Set Recordset=nothing
Connection.Close
Set Connection=nothing
%>

</body>
</html>

Thursday, November 6, 2014

Fwd: Process Oracle Visual Studios Connection


1. Install Oracle Client 32 Bit

2. in VS 2010 -> View -> Server Explorer

3. Right Click on Data Connection ->  Add Connection ->

in server name ->  //OracleServerName:PortNo/InstenceName

//dc01xxxxxxx03.xxxxxx.ccc:80903/hixxjd

user id and password

 

4. Test connection

gridview -> use director-> Create connection string

 

 

and SQL statement

 

SELECT  * FROM DevUSER(Schema Name).[Table Name] WHERE ROWNUM <= 100