Wrox Programmer Forums
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old March 19th, 2007, 02:15 AM
Friend of Wrox
Join Date: Dec 2006
Posts: 176
Thanks: 0
Thanked 0 Times in 0 Posts
Default SqlConnection

i have an wnidows server 2003 on vmware whit this ip address :
i install ms sqlserver 2000 on it
in my database (test) i have an table that its name is STD

inside the host(client) machine i created a appplication
in my application i have a button whit this name "btnRead"
inside my btnRead_Click event i write flowing code

                SqlConnection con = new SqlConnection("server=; database=test;Integrated Security=True;");

                    DataView dv = new DataView();
                    DataTable dt = new DataTable();
                    SqlDataAdapter da = new SqlDataAdapter("select * from STD", con);
                    dv = dt.DefaultView;
                    MessageBox.Show(dv[0]["stdName"].ToString() + "\n" + dv[0]["stdFamily"].ToString());

            catch (Exception ex)

                MessageBox.Show(ex.Message + "\n" + ex.StackTrace);

but my app cannot connect to my virtual machine
where is thw problem?
any one help me?
Old March 19th, 2007, 06:30 AM
Wrox Author
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons

What is the error you are getting?

================================================== =========
Read this if you want to know how to get a correct reply for your question:
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
================================================== =========
Why can't Programmers, program??
================================================== =========
Old March 19th, 2007, 09:05 AM
Friend of Wrox
Join Date: Dec 2006
Posts: 176
Thanks: 0
Thanked 0 Times in 0 Posts

this is error that i geting from program

error: 40-could not open a connection to sql server

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem when SqlConnection.Open() hoetat C# 7 July 6th, 2008 07:43 PM
SqlConnection Y.Hashmi ADO.NET 3 September 23rd, 2006 05:22 AM
about sqlConnection LeoG BOOK: Professional C#, 2nd and 3rd Editions 0 April 5th, 2006 02:01 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.