Link to home
Start Free TrialLog in
Avatar of John90631
John90631Flag for United States of America

asked on

How to use GridVIew in Microsoft Visual Studio 2017 to display, delete and update records in an MS SQL Database

I have an MS SQL database that I created using Microsoft SQL Server Management Studio 17. I went ahead and uploaded it to my webhost provider and even made an aspx.net bv.net page to read back one of the tables just to be sure I had the right connection to the database. All that works but now to save me coding time I wanted to create a GridView to display, delete and update specific records to the database.

I start the process of dragging a GridView to the aspx page in Microsoft Visual Studio 2017 then it asks for me to choose a datasource so I choose SQL and the data source defaults to SqlDataSource1 which I modify to be SqlDataSource2018 because I already have another 7 year old database that uses the name SqlDataSource1

The next step is to to specify the Data Connection which is available to me on the drop down menu.
This then makes the "Next" button at the bottom of the dialog box be available for clicking.

This where I run into a brick wall with the same message everytime.
I've embedded an image that displays the error message and I've also attached the file in case you cant see the embedded file (im new at this...)
User generated image
From what I can decipher the computer I think is stuck in trying to find the database locally within my computer but it needs to go to the database server's i.p. address!
Any suggestions to get me and my computer out of this rut?
Thank you for your help!
Avatar of HainKurt
HainKurt
Flag of Canada image

you should change your connection string and put host companies server address, username and password...
Avatar of John90631

ASKER

The connection string does have my host companies server address user name and password. I click on the details "+" ssign and it shows the ip address , user name and passwordUser generated image
can you test it from there? is it successful?
There is no test button at that point just a "Next" button and that is when it ends up displaying the error message.
if your connection string is correct, username and password is correct (not sure how did you put those values) it should work...
can you connect to db from this machine using odbc manager or ssms?
Yes, I can connect and add data to a table using ssms.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.