Please help, I can't create a connection between my web page and database in MS-Access/Sql-Server

Hi all Smile,

 Recently I was trying to establish a connection between my web page and the database made in MS-Access/SQL-server. But all my efforts were in vain at last.

 Please help me to do this. Write all the steps. Looking for a perfect solution. Smile

 

Thanking,
Kristian


 

0
contactkristian
3/4/2008 8:01:20 PM
asp.net.object-datasource 16182 articles. 0 followers. Follow

2 Replies
942 Views

Similar Articles

[PageSpeed] 15

Which is it? Access or SQL Server?  Here's a tutorial for Access: http://msconline.maconstate.edu/tutorials/aspnet20/default.htm 

Connection stirngs for all types of database can be found here: http://www.connectionstrings.com 

 


Regards Mike
[MVP - ASP/ASP.NET]
My site
0
Mikesdotnetting
3/4/2008 8:52:27 PM

hopefully u are using 2005, hope this helps, you can create connection between webpage and database by specifying the connection in web.config and you can get the values of database in different ways, I am just giving ya a example of how you can return it using a simple function, which returns arraylist

open your webconfig file and add this, this is to let your web application know where database is

<configuration>
    <appSettings/>
  <connectionStrings>
    <add name="justsomename that you wanna call this connection, let's call it myconnection" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Physicalpath of the database(C:/Whereeveryourdatabase is;Mode=ReadWrite;" />
  </connectionStrings>

now in your codebehind, make sure you import the necessary namespace, main ones you need are

Imports System.data
Imports System.Data.OleDb
Imports System.Data.Common
Imports System.Configuration

public shared function GetMeSomething() as arraylist

            dim mylist as new arraylist

           'note: when you are asking for the connection string, you need to use the same connection string specified in web.config

            Dim connectionString As String = ConfigurationManager.ConnectionStrings("myconnection").ConnectionString 

            'get connection string name and then set a new connection
            Dim myConnection As New OleDbConnection(connectionString)

          'specify your sql query in a string 

           Dim commandString As String
            commandString = "SELECT A FROM table1"

          'now create a command object with your connection object and sql query string

           Dim myCommand As New OleDbCommand(commandString, myConnection)

            'create a datareader where you can save the data read and then loop through it to get the values

              Dim result as  OledbDataReader

            Using myConnection
                myConnection.Open()
                result = myCommand.ExecuteReader

               If result.HasRows Then
                    While result.Read()
                        mylist.add(result.item("A"))
                    End While
                End If           

            myConnection.Close()
            End Using

            return mylist

End Function

0
abhisheks
3/4/2008 9:05:58 PM
Reply:

Similar Artilces:

Can't Connect .Net application from Windows Server 2003 to Database Server (SQL Server 2000)
Hi, I am having a problem connecting my .net applications from the application server to the database server. When I run the application from my windows xp (sp2) box it works fine. When I try to connect via SQL Management Studio to the database server from the application server I get the same error. Here is the error: System.Data.SqlClient.SqlException: An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider...

can't connect to sql server database with same connection used in visual studio .net 2003
I have the following code that works fine in visual studio .net 2003 but not with VWD.  I have sql server 2000 developer edition installed locally and this connection works fine with visual studio.  With VWD it fails with the exception "System.Data.SqlClient.SqlException: Login failed for user 'DARRELL\ASPNET'".  It fails on the conn.Open line.   any ideas on what the issue is?Dim conn As SqlConnectionDim connstr As Stringconnstr = "Data Source=DARRELL;Initial Catalog=Event;Integrated Security=SSPI;"Dim daEvents As New SqlDataAdapter("select * from events", connstr...

ERROR [HY000] [MySQL][ODBC 3.51 Driver]Can't connect to MySQL server on 'IP Address of the server'(10048) ERROR [HY000] [MySQL][ODBC 3.51 Driver]Can't connect to MySQL server on 'IP of the server' (10
Hi, I am randomly getting the following error message in my application. ERROR [HY000] [MySQL][ODBC 3.51 Driver]Can't connect to MySQL server on 'IP Address of the server'(10048) ERROR [HY000] [MySQL][ODBC 3.51 Driver]Can't connect to MySQL server on 'IP of the server' (10048) I am using .Net 2.0 with VS2005 having ODBC 3.51.14 Driver.  Can any body point out the core reasons of the above error message? Thanks. Nouman Khawaja. I do have the same problem, help me out. Thanks  If the going seems easy, You are going DownHill... When I was writing ...

Ubuntu Install: The local XML file './data/bugzilla-update.xml' cannot be created. Please make sure the web server can write in this directory and that you can access the web. If you are behind a prox
Hello list, I found the fix for this on SELinux via http://web.archiveorange.com/archive/v/lRMFnx3hwvEaH6nROdxg but I cannot find the way to adapt its findings to my Ubuntu install. /public_html/bugzilla# uname -a Linux hfs 2.6.35.4-rscloud #8 SMP Mon Sep 20 15:54:33 UTC 2010 x86_64 GNU/Linux drwxrwx--- 7 root www-data 4096 May 22 17:45 data Thanks! -- Ryan ...

can't link to sql server with ms access via web
hello. I have a windows 2003 server with sql server 2000 and a public IP address and domain name   when i am on the same network as the server  I can link to the sql server with just the dowmain name www.omghelp.com but when I take that same access adp file or mdb file home it says "database can not be found " what do i need to get it to work...help please  You could try connecting to this Windows 2003 server through a VPN connection and then trying to access your Access DB.--------------------------------------------------Sincerely,Michael ReyerosPlease rememb...

My Web Developer Express can't creat a sql server database...
Hello,  I can't creat a  database throught the Database Exploror---Data Connections.That menu Creat a new sql server database is gray,disabled.But I can creat a database throught the Sql Server 2005 Express Manager .Please help,how can I creat a database using the Database Exploror? Thans a lot! Qiwei Instead of Create New Sql Server Database, select Add Connection.  In the dialog, configure the database server you intend to use and then test the connection without a database.  Then, in the Select or enter a database name combobox, enter in the name of the n...

I can't connect to my local sql server express db. Please help
Hello, I need help to connect to my local sql express db in visual studio 2003 in vb.It currently works with the production db information and I need to test a few things, So i'd like to point it to the local db.It works this way:Const CONN_STRING = "server=johndoe;user id=john;password=doe;database=johnd"Dim conn As SqlConnection = New SqlConnection(Me.CONN_STRING)conn.Open()I want to point it to my local db and it doesn't connect.        Dim connectionString As String = "Data Source={myusername\SQLEXPRESS};Initial Catalog=johnd;Trus...

Help: Can't Update Ms Access DB record on Web Server (VS 2005)
Hi experts,  This is my first time using Visual Studio 2005 with Dot Net Framework 2.0 building aspx databinding files. I have created a MS Acess (file version 2003) database and uses  DetailView function - insert, edit, delete ready available function. The insert, edit and delete function is working fine on my localhost webpage but when i posted all the files to my web server and i got the following error. Can anyone assist me here? Billion thanks ------------------------------------------------------File script-----------------------------------------------------...

Help setting backup server on Linux: Can't open a connection to site 'SYB_BACKUP'. See the error log file in the SQL
Greetings, I'm very new to Sybase and i'm trying to backup up all our development databases using a remote server; The development Sybase server doesn't contain enougf free space to dump all the databases so i want to use a remote Backup server onto another Linux machine. I tried to run a simple dump of an small databse to a disk file but got this weird error: bash-2.05$ isql -Dmaster -Usa -SSYLNXDEV2 Password: 1> dump database NewBreak to "/opt/sybase-11.9.2/testdump.dmp" 2> go Msg 7205, Level 17, State 2: Server 'SYLNXDEV2', Line 1: ...

Please help. Can't write to hosted SQL database from internet website but can from desktop website
My VWD website runs fine from my home computer. Ican read from and write to the GoDaddy SQL server,  but when I run the exact same website  from their web host  server  I  can  only read data from the SQL  server. Oviously it has to do with permission. GoDaddy has no answer.  Hi alyii, From your description, I guess you have to contact GoDaddy and let them check whether the IIS identity has write permission for your database in SQL Server. Thanks.David QianMicrosoft Online Community SupportPlease remember to mark the repli...

can't connect to MS sql-server
Hi. We have an application developed using DPB. Each pb client connects to 3 different dbs on the same server (3 transactions). Each client session connects to 2 different dbs on the same server. Total of conections per client: 5 When the nineth client session on the server tries to connect to the database the sqlerrtext returns the following message: sql returned bad error code If I run 3 exes on the server listening 3 different ports, each of them serves 8 clients. TIA -- Marcelo Dias dias@dcs.com.br diasms@hotmail.com MS SQL has a default of 25 connect...

can't create database for ms-access
This is a multi-part message in MIME format. ------=_NextPart_000_0016_01C0B940.C35AFEE0 Content-Type: text/plain; charset="windows-1251" Content-Transfer-Encoding: quoted-printable Hi, I've made a physical data model and checked it for errors. Power = designer 8.0 said that the model is OK. So then I generated script to = create database in MS-Access 2000. I opened the access2k.mdb, put script and future db name and pressed = Create. So, I got an error: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=...

can't create database for ms-access
This is a multi-part message in MIME format. ------=_NextPart_000_0019_01C0B968.47A9C6A0 Content-Type: text/plain; charset="windows-1251" Content-Transfer-Encoding: quoted-printable Hi, I've made a physical data model and checked it for errors. Power = designer 8.0 said that the model is OK. So then I generated script to = create database in MS-Access 2000. I opened the access2k.mdb, put script and future db name and pressed = Create. So, I got an error: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=...

Can't connect to ms access database
Hi GuysI am creating a small asp.net web-based app, and putting it on my local server, I have put all the files into a folder on Drive F: setup a virtual directory in IIS pointing to the folder in Drive F: that my site sits in.My Only problem I have got is in my code I have this for the database pathServer.MapPath ( "/sites/computerdb/" + db + ".mdb" ) );Now when I go to view the site it comes up with'c:\inetpub\wwwroot\sites\computerdb\gear.mdb' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides. now how ...

Web resources about - Please help, I can't create a connection between my web page and database in MS-Access/Sql-Server - asp.net.object-datasource

Connection - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

iMedia Connection: Interactive Marketing News, Features, Podcasts and Video - iMediaConnection.com
High-quality data, if not used properly, can still lead marketers to make bad decisions. Consider these common ways that numbers are used to ...

HTTP persistent connection - Wikipedia, the free encyclopedia
... tacked on to an existing protocol. If the browser supports keep-alive, it adds an additional header to the request: Following this, the connection ...

CareerSonar Turns Facebook Friends Into Job Connections
Looking for a job ? Among your Facebook friends lies the potential for employment. CareerSonar , a new service, brings together a person’s connections ...

Complex Regional Pain Syndrome: CPRS researchers study auditory connection
For 16 years Kerry Whyman ``secretly&quot; thought she had bone cancer and was dying secretly because she'd stopped telling doctors how much ...

Fictional Lawyers Use Their Family Connections Too
This film character had a family connection to his lawyer.

This Is How Facebook Is Working to Improve Experience On Slower Connections
... the globe, that’s not their situation . In recent years, Facebook has paid close attention to its user experience on 2G and other slow connections. ...

Addappt now lets you block contacts and connections
... gives you even more control than before. New features Block a current contact from connecting if they use Addappt down the road Block a connection ...

Facebook becomes more adept at dealing with crappy connections
... to get a decent phone signal to allow you to post a photo of your meal. Joking aside, in countries where people are struggling with 2G connections ...

Is There A Connection Between Patrick Murphy's Over-The-Top Corruption And His Campaign Emails?
The DCCC may be stupid or even very stupid (as well as utterly incompetent) but their e-mail strategy is very well-planned out. Their overarching ...

Resources last updated: 12/11/2015 2:55:48 AM