i find it difficult to add mssql dbs to asp.net website when i am using vs2008.
here i intend working locally. please let someone help me.

Recommended Answers

<%@ Page Language=VB Debug=true %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SQLClient" %>
<script runat=server>
Sub Page_Load(ByVal Sender as Object, ByVal E as EventArgs) ' or button click event
    If Not IsPostBack Then
        Dim DBConn as SQLConnection
        Dim DBCommand As SQLDataAdapter
        
       
       DBConn = New SQLConnection("server=localhost;" _
            & …
Jump to Post

All 2 Replies

<%@ Page Language=VB Debug=true %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SQLClient" %>
<script runat=server>
Sub Page_Load(ByVal Sender as Object, ByVal E as EventArgs) ' or button click event
    If Not IsPostBack Then
        Dim DBConn as SQLConnection
        Dim DBCommand As SQLDataAdapter
        
       
       DBConn = New SQLConnection("server=localhost;" _
            & "Initial Catalog=TT;" _
           & "User Id=sa;" _
           & "Password=yourpassword;")
        
        DBCommand = New SQLDataAdapter( _
            "create table employee(empid int, empname varchar(20), salary int);")
                              
       
    End If
End Sub

>i find it difficult to add mssql dbs to asp.net website when i am using vs2008.

Steps:

1. Create/open a "WebSite"
2. Select WebSite menu
3. Select Add New Item
4. SQl Server Database (.mdf)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.