mirror of
https://github.com/EiffelSoftware/eiffel-org.git
synced 2025-12-06 14:52:03 +01:00
Author:halw
Date:2008-12-22T14:23:38.000000Z git-svn-id: https://svn.eiffel.com/eiffel-org/trunk@144 abb3cda0-5349-4a8f-a601-0c33ac3a8c38
This commit is contained in:
@@ -51,15 +51,30 @@ When the display is finished, the application wait for you to pressed the return
|
||||
|
||||
This application shows how to interact with a database. First the connection to the database is opened:
|
||||
<code>
|
||||
create my_sql_connection.make_from_connection_string (my_database)
|
||||
create connection.make ("server=(local)\NetSDK;Trusted_Connection=yes;database=northwind")
|
||||
</code>
|
||||
Then a request to the database is made:
|
||||
<code>
|
||||
create my_sql_command.make_from_cmd_text_and_connection (my_command, my_sql_connection)
|
||||
create command.make ("select * from customers", connection)
|
||||
connection.open
|
||||
reader := command.execute_reader
|
||||
</code>
|
||||
Finally, the result of the request is displayed.
|
||||
Finally, the result of the request is displayed:
|
||||
<code>
|
||||
from
|
||||
ok := reader.read
|
||||
until
|
||||
not ok
|
||||
loop
|
||||
io.put_string (reader.item ("CustomerID").to_string)
|
||||
io.put_string ("%T%T")
|
||||
io.put_string (reader.item ("CompanyName").to_string)
|
||||
io.new_line
|
||||
ok := reader.read
|
||||
end
|
||||
</code>
|
||||
|
||||
This sample contains the following class:
|
||||
This sample uses the following ADO.NET classes:
|
||||
* <eiffel>SQL_DATA_READER</eiffel>
|
||||
* <eiffel>SQL_CONNECTION</eiffel>
|
||||
* <eiffel>SQL_COMMAND</eiffel>
|
||||
|
||||
Reference in New Issue
Block a user