Simplest Way To Connect To Mssql Db

Jan 22, 2007

I'm an absolute beginner in asp/asp.net. You have been warned.

I managed to run and compile asp.net using win xp home edition, via Visual Web builder 2005 express edition. I managed to use its tools to create a test database and table and put values in it.

Now I wish to connect to this db using my aspx page. While fiddling around I finally able to drag the "table" icon on the database pane into my aspx page and it generate a code snippet below:

    <div>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1"
            EmptyDataText="There are no data records to display.">
            <Columns>
                <asp:BoundField DataField="US_ID" HeaderText="User id" SortExpression="US_ID" />
                <asp:BoundField DataField="US_NAME" HeaderText="USer Name" SortExpression="US_NAME" />
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:nepConnectionString1 %>"
            ProviderName="<%$ ConnectionStrings:nepConnectionString1.ProviderName %>" SelectCommand="SELECT [US_ID], [US_NAME] FROM [USER]">
        </asp:SqlDataSource>
    </div>

 When previewed in the browser, it seems to show the content of the db table. 

What I want to know is a sample coding on how to connect to the db the usual way (initialise the connection string, prepare and execute the query, fetch the content of resultset). Based on the code snippets above (it contains the info about the db name, table name and the column name I'm using), can anyone guide me by providing the lines of codes that retrieve the data?

 Basically the first thing I would like to do is fetching the data to be compared with user name and password submission after they click on login, among other basic stuff, which doesn't require bells and whistles like <gridviews> and other contraptions provided.

And another thing, would the connection string or other parameters be any different from my computer if I were to upload my aspx page including the mssql db file into my webhosting to be tested live?

Thanks for anyone out there willing to provide some hand-holding here! 

 

 

 

 

 

 

 

 

 

View 2 Replies


ADVERTISEMENT

Connect MSSQL Without VPN

May 24, 2007

Hi All,

I have a mssql server that is located somewhere and i can only able to access it with my pc mssql when VPN is connected. Is there any solution/configuration that can let me to access the it without connecting to the VPN?
Please advice.

View 4 Replies View Related

Can Not Connect To Mssql With Php

Jun 6, 2007

Using mssql_connect($server, $user, $password) results in different ways the 'php server'

connects to the sql server.

On a workstation with WinXPProf, php uses the $user and $password to login and uses the

sql server authentication. Running the same script from a W2K3 server results in an error

because in this case the 'php server' tries to connect to the sql server using windows

authentication. (I have checked this difference with wireshark)

The problem has nothing to do with the sql server settings (mixed mode) / firewalls /

php.ini- file settings or versions of ntwdblib.dll because these are the same for both

connections. The problem looks more fundamental, probably due to settings in windows or

the iis version running on the server and the workstation.

Does anyone has a clue how to force php to use sql server authentication.



Pitching Theo pitcher_32@hotmail.com

View 2 Replies View Related

Best Way To Connect To A MSSQL Database

Nov 6, 2007

 Hello,Is it better to use a DSN connection or using a connection string  Set Connection = Server.CreateObject("ADODB.Connection")  Which is easier to use and more reliable? Also could I have all the connection info on one page and then just include it with a include statment everytime I need to query the database?? Thank you, Rich    

View 4 Replies View Related

How Many Users Can Connect To One Database In MSSQL

Nov 7, 2001

Dear Sir,
Can you please let me know as to how many users can MSSQL support at one time on a single database say test.

Thanks
Aman Gupta

View 2 Replies View Related

Win32::ODBC Connect To MSSQL

Apr 19, 2004

Hi,

I wanted to know if there is a way to connect to my MSSQL without having to setup a datasource in the control panel.

Perferably I want to locate the database within my perl code instead. I don't want to have to setup a datasource each time I need a different database. Perhaps there is a way to pass the name of the database along with the username and password through the command line.


Any suggestions?

Thanks.

View 5 Replies View Related

How To Connect To MSSQL Server From HP-UX Environment

Oct 9, 2006

Hi,Please confirm.. is it possible to connect to MSSQL server by executinga shell script on HP-UX (UNIX) platform.Regards,Uncle Sam

View 3 Replies View Related

FILE DSN On UNIX To Connect To MSSQL

Sep 19, 2007

Hello experts,

I need to create a File DSN on AIX Unix server which can connect to MS SQL server 2005 on a windows machine.Can anyone please give me step by step procedure how to do it.Its an urgent requirement. Please help me.

Regards
Arvind L

View 3 Replies View Related

MSSQL 2000 - Cant Connect To DB From Remote Computer

Jun 21, 2006

Please bare with me as I do not have much knowledge in this area with MSSQL.

I have installed MSSQL 2000 Developer and I have setup a database which I am able to connect to and work fine with from the actual server MSSQL is installed on.

The problem comes in when i try to connect to that same database from a different remote server. It will not connect to the DB from this remote server but I know all the connection information is correct so its something on the MSSQL DB server causing this and not on this remote server.

Someone I know has had this problem and has fixed it but they wont tell me how. All I know is they said something about manually opening the ports on the MSSQL server and he also said when you set it to dynamicly determine the port that MSSQL is listening on it errored out. however if you set it staticly to 1433 it worked fine.

Ive also installed SP4 in attempt to fix this but no luck with that either. And I can also get the same exact remote server to connect to completely different DB server without issues.


If anyone can please help walk me through this I would be greatly appreciate and I am also willing to pay some money if it will make my life easier.

View 6 Replies View Related

Unable To Connect To Mssql Server Using Sql Express

Oct 13, 2006

Hi,

I installed Sqlexpress server 2005 and am able to connect to the server using the sqlexpress manager.

The connection parameters are:

server: 127.0.0.1 (This is an alias name pointing to TMD03SQLEXPRESS)
username:sa
password:test
mode: sql server and windows authentication mode
TCP/IP : enabled and listening on port number 1433.

But I am not able to connect to the server using PHP's mssql_connect function.

I tried various combinations like

mssql_connect("127.0.0.1","sa","test")
mssql_connect("local","sa","test")
mssql_connect("localhost","sa","test")
mssql_connect("TMD03SQLEXPRESS","sa","test")
mssql_connect("127.0.0.1,1433","sa","test")

but none of them works. I also tried OSQL and SQLCMD and they don't work either. They give me the following error message.

[SQL Native Client]Named Pipes Provider: Could not open a connection to SQL
Server [2].
[SQL Native Client]Login timeout expired
[SQL Native Client]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.

Can anyone please let me know what am doing wrong here?

Regards,
Celia

View 12 Replies View Related

Connect To Remote MYSQL From The Local Mssql

Dec 21, 2007

how ?

View 4 Replies View Related

Cant Connect To MSSQL Server Express 2005

Nov 6, 2006

Hi,

i have installed MS SQL Server Express 2005 on my local machine. Also the managment Studio. I can connect to the MS SQL Server Express 2005 with my c# programm and with the mangament studio.

I have in Windows/system32 the file ntwdblib.dll version 2000.80.2039.0. The TCP/IP and Ip Protocl are active. But i cant connect with php to the local MS SQL Server Express 2005.

My php code is:

mssql_connect('192.168.0.2,1433', 'martin', '');

I get the return code Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: 192.168.0.2,1433 in c:InetpubwwwrootProjekteSkriptemssql_connection.php on line 2


Does anyone know what i made wrong or i have forgotten?

mfg martin

View 5 Replies View Related

Cannot Connect By Naming Instance In Mssql 2005 Cluster

May 9, 2007

Hello,



I install Cluster naming instance of MSSQL 2005 Enterprise edition with SP2 and latest patch.

When I try connecting this instance from outside of the server by "server nameinstance name" I got connection error.

But when I connecting by "server name,port number" it's connecting with no problem.

Can someone help me resolve connection outside of the server with "server nameinstance name"?



Thanks

View 7 Replies View Related

Simplest Method For SQL Insert

Jun 13, 2007

I have spent the afternoon researching this, and to no avail so here's my question.
I have a user input form with upwards of 60 fields that are to be filled in by the user (intranet environment).  I want to post those values as a new record in an SQL database.   I have setup an SQLDataAdapter tied to a parameterized stored procedure on the SQL server.   I can successfully post data from the controls on the form when I set the parameter type to Control based.
Here's the problem, though.  I need to do some pre-processing on most of the values in the controls on the form.  I have setup VB code (that executes when the user clicks the "Submit" button), that pulls in each control value, performs any necessary processing, and sets a variable to the value I actually want stored in the DB.  How can I assign THAT value (from the variable) to the parameter for the stored procedure?  
Thanks,
Dave

View 5 Replies View Related

Simplest Way To Crash A Sql Server

Jul 10, 2006

Hi,
What is the simplest way to crash a sql server?
Somebody asked me that question, and I was unable to give the best answer. Please help me to find it.
Thanks!!
Joydeep

View 14 Replies View Related

Simplest Way To Get Column Names

Mar 10, 2008

i need to retrieve column names in a rowset, let me explain a bit;

i can simply retrieve a column name by using IColumnsInfo::GetColumsInfo, but the problem is when i use "AS" keyword in the select statement such like;

SELECT identification AS id FROM test_table_a

i see alias name of that column instead the internal column name.

as you can guess the qestion is; how can i get both alias and internal name at the same time and of course what is the *usual* way to get it.

thanks in advance

View 4 Replies View Related

Simplest SQLDataSource Question Of All Time

Feb 22, 2008

Say I have a SQLDataSource name "srcUserInfo" that calls a view with a field called "UserName"...
 
...then...during Page_Load I want to add the value returned in the "UserName" field to a variable we will call...say..."ActiveUN"...
 
How would I write the code to call the UserName field and put its data into the ActiveUN variable?
 
Thanks in advance...MDCragg

View 2 Replies View Related

Simplest Way To Get A Query Result Into A Variable

May 25, 2004

Hello,

I am interested in what the simplest was to get a query result that will only ever have one result (ie One column, one row) into a variable. An ugly way is to use a cursor that simply fetches the first row but that seems to be a horrible way to do it and it has sometimes major drawbacks sometimes (mainly if I have to dynamically choose the table). Surely there is a better way?

What do you think? A simple example would be nice.

Cheers
J

View 11 Replies View Related

Simplest Form For Data Entry

Nov 20, 2007

I am researching ideas for the best way to have users enter data into SQL.

I am familiar with VB and Access Forms and HTML coding but what I am looking for is a way to have a standalone app or website where users can enter information but I want the form to have branches that change depending on user input (such as selecting a meeting type then having specific questions open up related to it).

Any ideas on the best way to do this?

If a different forum would be better for this request please advise and I will move appropriately.

Respectfully,

Lewis

View 2 Replies View Related

Whats The Simplest Way To Set Up Replication Through Firewall?

Dec 8, 2005

whats the simplest way to set up replication through firewall?

View 1 Replies View Related

Simplest Transfer SQL Server Objects Task Failure

Feb 17, 2007

I'm perplexed and in need of a sanity check ...

Instance of SQL2K5-SP1 on Server2003R2. Created two databases Test1 and Test2, create single 2-column table (tblTest)in Test1 with one row of data. Create SSIS package to transfer the table and its data to database Test2 using "Transfer Objects Task". Fails with error code 1073548784.

I have tested for security issues and don't beleive these to be the cause: I have monster privelidges and can successfully use SSIS packages to execute CREATE TABLE etc.

Have also tried most combinations of Task options (eg COPY ALL OBjects etc etc)

Have tried this on three different servers: same results.

This simple test is the result of distilling down problems I'm having with SSIS manipulating some 60G within some 300 tables, so I'd really like to use the power this task promises!

My head is getting a little sore from scratching - any advice gratefully received.



Thanks

View 6 Replies View Related

How Many Result-rows Does Mssql Return Should Be Used Asynchronous Method To Use Mssql Cursor?

Aug 11, 2004

How many result-rows does mssql return should be used asynchronous method to use mssql cursor, can get the best performance in any time in any result offset?

i want to make the cursor fast in any time whatever how many results returned

View 2 Replies View Related

Database Migration Plan - (mssql/msde To -&> Pgsql/mssql)

Feb 10, 2008

Hi,

i was planning to create a database migration tool ..
its a certain database of a DMS (document management system) to
another DMS (two different DMS)... from DMS using msde 2000 server .. and tranfer to a DMS using a postgre sql or mssql .. depends ..

they have different table structures and names . . :D

i was thing of what language shall i use.. or what language is the best to work on this kind of project :)

hoping for your kind help guys. thanks :)



br
Frozenice

View 1 Replies View Related

Server Configuration For MSSQL 2000 And MSSQL 2005

Sep 6, 2006

Does enabling/disabling Data Execution Prevention have a performanceimpact on SQL 2000 or SQL 2005?For SQL best performance - how should I configure for:Processor Scheduling:Programs or Background servicesMemory Usage:Programs or System Cache

View 9 Replies View Related

Creating Index In MSSQL 2000 From MSSQL 2005

Mar 24, 2008

Hi,

I am a bit new to the MSSQL server. In our application, we use so many SQL queries. To imporve the performance, we used the Database enigine Tuning tool to create the indexes. The older version of the application supports MSSQL 2000 also. To re-create these new indexes, I have an issue in running these "CREATE INDEX" commands as the statements generated for index creation are done in MSSQL 2005. The statements include "INCLUDES" keyword which is supported in MSSQL 2005 but not in MSSQL 2000.

Ex:-

CREATE INDEX IND_001_PPM_PA ON PPM_PROCESS_ACTIVITY

(ACTIVITY_NAME ASC, PROCESS_NAME ASC, START_TIME ASC, ISMONITORED ASC)

INCLUDE

(INSTANCE_ID, ACTIVITY_TYPE, STATUS, END_TIME, ORGANIZATION);


Any help in creating such indexes in 2000 version is welcome.

Thanks,
Suresh.

View 2 Replies View Related

Generating Script For MSSQL 2000 From MSSQl 2005?

May 3, 2008

Hello
We are using SQL 2005 and now we are planning to use SQL 2000. what are the ways to do the process.

We taken the script spcificall for 2000 and run it in SQL 200. But we are getting the error in SCRIPT?

Could you please give me the step to do?

Thanks,
Sankar R

View 6 Replies View Related

Run Mssql 6.5 Client And Mssql 7.0 Server On Same Nt Workstaton?

Oct 26, 1999

Hello:

I am currently work on mssql 6.5. On my workstation, I have mssql 6.5
cient software.

However, I would like to install mssql 7.0 server on my nt workstation
and work with it to become familiar with 7.0. Can I install mssql 7.0
server on my nt workstation? Can mssql 6.5 client coexist with mssql 7.0
on the same machine if they are in different directories?

Thanks.

David Spaisman

View 1 Replies View Related

MSSQL Express 2005 Vs. MSSQL 2000

Jun 15, 2006

Ben writes "I have a sql script that doesn't function very well when it's executed on a SQL 2000 server.

The scrpt looks like this:


---------------------------------------------------------------------------------------------------
USE [master]
GO
IF NOT EXISTS (SELECT * FROM master.dbo.syslogins WHERE loginname = N'SSDBUSERNAME')
EXEC sp_addlogin N'SSDBUSERNAME', N'SSDBPASSWORD'
GO
GRANT ADMINISTER BULK OPERATIONS TO [SSDBUSERNAME]
GO
GRANT AUTHENTICATE SERVER TO [SSDBUSERNAME]
GO
GRANT CONNECT SQL TO [SSDBUSERNAME]
GO
GRANT CONTROL SERVER TO [SSDBUSERNAME]
GO
GRANT CREATE ANY DATABASE TO [SSDBUSERNAME]
GO
USE [master]
GO
If EXISTS (Select * FROM master.dbo.syslogins WHERE loginname = N'SSDBUSERNAME')
ALTER LOGIN [SSDBUSERNAME] WITH PASSWORD=N'SSDBPASSWORD'
GO
GRANT ADMINISTER BULK OPERATIONS TO [SSDBUSERNAME]
GO
GRANT AUTHENTICATE SERVER TO [SSDBUSERNAME]
GO
GRANT CONNECT SQL TO [SSDBUSERNAME]
GO
GRANT CONTROL SERVER TO [SSDBUSERNAME]
GO
GRANT CREATE ANY DATABASE TO [SSDBUSERNAME]
GO
USE [master]
GO
IF EXISTS (select * from dbo.sysdatabases where name = 'ISIZ')
DROP DATABASE [ISIZ]
GO
USE [SurveyData]
GO
exec sp_adduser 'SSDBUSERNAME'
GRANT INSERT, UPDATE, SELECT, DELETE
TO SSDBUSERNAME
GO
USE [SurveyManagement]
GO
exec sp_adduser 'SSDBUSERNAME'
GRANT INSERT, UPDATE, SELECT, DELETE
TO SSDBUSERNAME
---------------------------------------------------------------


I need to be converted to a script that can be executed on both MSSQL 2000 and MSSQL 2005.

I was wondering if somebody there could help me with this problem?!

Thanks,
Ben"

View 1 Replies View Related

Migration MSSQL 2000 32-bit To MSSQL 2005 64-bit

Nov 17, 2007

I've been tasked to move our production databases on MSSQL 2000 to 2005. I've supported MSSQL since version 6.5 and performed migrations to successor versions.

Current Environment is MSSQL 2000 32-bit with current Service Packs.

I've performed mock migrations on Test servers upgrading all Production instances simultaneously from MSSQL 2000 to 2005 32-bit. The Test environment is identical to Production minus server name, IP etc. Also I have a separate server with MSSQL 2005 installed where I use the DETACH / ATTACH and BACKUP / RESTORE method for migration / acceptance testing. There are approximately 30 databases totaling 70 GB. This has gone as expected and fairly successful. Vendors have been coordinated with to update code and staff for acceptance testing.

I'd prefer going directly to MSSQL 2005 64-bit instead if possible due to memory benefits etc. This is where I'd like some feedback prior to borrowing a 64-bit server for testing.

Upgrade options:

1. Is it better to migrate from MSSQL 2000 32-bit to 2005 64-bit via:
a. DETACH / ATTACH
b. BACKUP / RESTORE
c. Is one method more advantageous relating to the end result?
2. Regarding XP clients, have issues been experienced with the default SQL Server driver or is an alternate recommended for XP clients to connect to a MSSQL 64-bit server databases?
3. If you have performed this migration and have relevant experience please pass them along.

View 3 Replies View Related

Deploying MSSQL 2005 Express DB To MSSQL 2005 WKGP Errors

Sep 29, 2006

DB is developed on local computer with MSSQL 2005 Express. My host is on MSSQL 2005 workgroup. Are they compatible, because I am getting errors? Is my approach wrong?

I have tried several approaches.

A) I created a backup of database on my local, then placed a copy on the server. Then I tried to restore through Server Management Studio. I get this error.

TITLE: Microsoft SQL Server Management Studio

------------------------------

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

------------------------------

ADDITIONAL INFORMATION:

The backed-up database has on-disk structure version 611. The server supports version 539 and cannot restore or upgrade this database.

RESTORE FILELIST is terminating abnormally. (Microsoft SQL Server, Error: 3169)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=08.00.2039&EvtSrc=MSSQLServer&EvtID=3169&LinkId=20476

------------------------------

BUTTONS:

OK

------------------------------



B: I also have tried copying the database. I put it in the same path as the other databases that can be read with server management studio on the server. Then, tried to get to it through server managements studio and it did not appear. So I tried to attach it. Then I received this error:

TITLE: Microsoft SQL Server Management Studio

------------------------------

Attach database failed for Server 'MROACH1'. (Microsoft.SqlServer.Smo)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.2047.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Attach+database+Server&LinkId=20476

------------------------------

ADDITIONAL INFORMATION:

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

------------------------------

Could not find row in sysindexes for database ID 10, object ID 1, index ID 1. Run DBCC CHECKTABLE on sysindexes.

Could not open new database 'LodgingDB'. CREATE DATABASE is aborted. (Microsoft SQL Server, Error: 602)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=602&LinkId=20476

------------------------------

BUTTONS:

OK

------------------------------

C: I have also tried opening the Database, and back up file through Server Management Studio. without success.

D: I also tried Windows and Software update at microsoft update, but no updates were recommended for Version on Server.

I'm surprised this is so hard. My original data base was created in same family of software. 2005 MS SQL Express. I could use some direct help from someone experienced with this. Am I doing it wrong or are the DB versions incompatible.

Mark Roach





View 5 Replies View Related

Conversion Of MSSql 2000 Database To MSSQL 2005 Database

Jan 18, 2008

How to convert a database in MSSQL 2000 to MSSQL 2005 database.Is there any tool or documentation available for this?

View 3 Replies View Related

SQL 2012 :: Applications Cannot Connect Because Logins Cannot Connect To Their Default Databases

Oct 17, 2014

I designed the AlwaysOn wrong, but every time we fail over from primary server to another server, my applications cannot connect because the sql logins cannot connect to their default databases. Once I run the command to link the login with the user in the default database then the users are able to connect. Did I do something wrong when designing AlwaysOn?

View 9 Replies View Related

GUI Client For MsSQL (was: MSSQL Help)

Sep 25, 2007

I have my MSSQL hosted, any interface i can use so i can't connect to the data source?

for Mysql, i know i can use phpmyadmin, or mysql interface.

i have no idea for MSSQL, any advices?

i know there is one, which is Toad, but it has a lots of limitations, any good idea?

thanks.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved