ado.net
how the methods ado.net in the console work, that is, how the whole process behind them is carried out because they are written in code in the end
6 Replies
Could you elaborate?
im also dont understand what you are asking for but the rough design of ado drivers is that they connect to the database server via tcp (some times other protocols, sometimes its an in-process driver)
then for each request/query u send u basically have the query as string represantation (eg.
SELECT foo FROM bar
) and optionally data for that request (eg. if u have parameterized queries like SELECT foo FROM bar WHERE id = @Id
)
the database engine itself (mostly on the server side, like mssql, postgresql, mysql, mariadb, etc) will parse this query string to do its work to generate data to send back
for which u would then use a data reader provided by the ado.net driver to process the results.
ofc there is a lot more to it than just this, but it explains the basic principle of whats going on.
i hope this basic and rough explanation helps you to formulate your question betterI can't understand how a code in visual studio written in ado net can create tables, I know what each class and part does but I can't understand does visual studio have something to create tables
well, if u use visual studio or notepad doesnt really matter here,
its about which ado.net driver/database system u want to use.
eg there is https://www.npgsql.org/doc/#getting-started for postgresql, tho it doesnt show how to create a table
but in the end u have to learn 2 things
1) the SQL dialect itself (there are differences between postgresql, mssql, sqlite, mysql, etc)
2) how to use the ado.net driver for the database of your choice to execute the sql queries (what ya learned in 1) )
Visual Studio doesn't have anything
You give ADO the connection string to the database
ADO calls that database saying "here's the code, do whatever with it"
If the code creates a table, then the database creates a table
creating tables is a really complex thing because thats the thing where u tweak everything to squeeze out performance
for postgresql to create a table is the documentation at https://www.postgresql.org/docs/current/sql-createtable.html.
at the top is the very long and complex syntax for the query, and a bit later on the same page are examples.