Share via

ASP.NET USING DATABASE API

neeraj bhushan 1 Reputation point
2022-05-05T16:19:44.027+00:00

Sir,

I am working in ASP.NET in VS2010 language vb.net.

I am using SQL Server Database which is on a local server and I have the username and Password of the DATAbase.

Now I am to connect to a database which is not on my local server and somewhere else. The Owner said that they will share API for the database.

I don't know how to use API for database connection.. Pl. guide me with an example.

Thanks

Developer technologies | ASP.NET Core | Other
0 comments No comments

2 answers

Sort by: Most helpful
  1. Sreeju Nair 12,761 Reputation points
    2022-05-06T11:32:23.287+00:00

    Hey @neeraj bhushan ,

    Inorder for you to connect to the data base directly from the .Net Application, you need the connection string, so that your .Net applicaiton can connect to the database. Ask the database owner to provide you the connection string.

    If they have an API (I assume it is web based API), that mean, it is not direct database connection, they must have built an API, with certian functionality that allows you to interact with the data. This is how multiple systems interact together, for e.g. you may integrate with Microsoft Graph API to connect with the data in Microsoft 365. If you want to build an application that works with APIs, you can use consume the Web API from your .Net application. The following articles may help you in consuming Web API

    https://www.tutorialsteacher.com/webapi/consume-web-api-for-crud-operation

    Hope this helps

    Was this answer helpful?

    0 comments No comments

  2. Yijing Sun-MSFT 7,106 Reputation points
    2022-05-06T02:50:55.677+00:00

    Hi @neeraj bhushan ,
    first, you need to choose what technology use to access database, you can use Entity Framework, Classic ADO.NET, NHibernate, for example with Entity Framework read: Entity Framework (EF) Documentation, also read: Using Web API 2 with Entity Framework 6.

    Best regards,
    Yijing Sun


    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our  documentation  to enable e-mail notifications if you want to receive the related email notification for this thread.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.