开发者

How To Establish A Connection To Database Using C# Application?

开发者 https://www.devze.com 2023-03-17 19:20 出处:网络
Im using Visual Studio 2008 . and wants to connect to database. My Application (in C#) is to develop a form acts like Image Viewer and to perform insert an image and delete an image , Also To Display

Im using Visual Studio 2008 . and wants to connect to database. My Application (in C#) is to develop a form acts like Image Viewer and to perform insert an image and delete an image , Also To Display the images I开发者_如何转开发n Database


Refer this walkthrough:

http://msdn.microsoft.com/en-us/library/tzedkwye%28v=VS.80%29.aspx


Assuming that your DBMS is Sql server. You could do for example

SqlConnection conn = new SqlConnection("connString here");//conn string here
conn.Open();//if using SqlDataReader
SqlCommand cmd = new SqlCommand("your query", conn);///your command object
....
.....

In order to insert the image to the database, there are mainly two options, either to save the image path in the database or save the image itself in database as BLOB.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号