Tech
Forums
Jobs
Books
Events
Videos
Conference
Annual Conference
Bcrypt
Ai Conference
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
2
Answers
Asp.net Webpage Database connection
Ask a question
Ask a question
Upload Source Code:
Select only zip and rar file.
Sadaqat Jeelani
8y
453
1
Reply
@{
var db = Database.Open("SmallBakery");
var selectQueryString = "SELECT * FROM Product ORDER BY Name";
}
<html>
<body>
<h1>Small Bakery Products</h1>
<table>
<tr>
<th>Id</th>
<th>Product</th>
<th>Description</th>
<th>Price</th>
</tr>
@foreach(var row in db.Query(selectQueryString))
{
<tr>
<td>
@row.Id
</td>
<td>
@row.Name
</td>
<td>
@row.Description
</td>
<td align="right">
@row.Price
</td>
</tr>
}
</table>
</body>
</html>
Here is my code i tried many time but con't connect i shows (
An exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll but was not handled in user code
Additional information: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL
)
some one told me do some changes in web.config file but i don't know which type of changes are that?
Post
Reset
Cancel
Answers (
2
)
Next Recommended Forum
Object reference not set to an instance of an object.
How to auto logout after 1hr of inactivity