How do I run a .Net program that uses SQL Server across a network

M

meerkat

Can anyone help me get my program to work over a network.

To keep it simple, I have two buttons, a text box and a Datagrid.

Clicking Button1, displays "Hello" in the textbox.
Clicking Button2, fills the Datagrid with data from Northwind.

The program is installed on a Windows 2000 and a Windows 98 machine.
The 2000 machine has SQL Server Developer installed and the 98 machine
has
SQL Server Personal edition installed.

I set a the Trust an Assembly stuff in the .net Wizards and ran my VB
DOTNET program directly from each machine.
Everything worked fine.

When I tried to run the program from the other machine across the
network,
Button1 displays "Hello" OK but when I press Button2, the message
shown at the end appears.

Private Sub Button2_Click( etc )
SqlDataAdapter1.Fill(DataSet11, "Customers")
DataGrid1.DataSource = DataSet11
DataGrid1.SetDataBinding(DataSet11, "Customers")
End Sub

The Connection String is
workstation id=DELL8300;packet size=4096;user id=sa;data
source=DELL8300;persist security info=True;initial
catalog=Northwind;password=thingy

I hope someone out there knows what to do because I certainly don't

Thanks in anticipation,

Meerkat

-------------------------------
The application attempted to perform an operation not allowed by the
security policy. The operation required the SecurityException.
To grant this application the required permission please contact your
system administrator, or use the Microsoft .NET security policy
administration tool.

If you click Continue, the application will ignore this error and
attempt to continue. If you click Quit, the application will shut down
immediately.

Request for the permission of type
System.Data.SqlClientPermission, System.Data,
Version=1.0.5000.0, Culture=neutra,
PublicKeyToken=b77a5c561934e089 failed.
--------------------------------------
 
W

William \(Bill\) Vaughn

When you install MSDE (Personal Edition) and SP3a (you had better make sure
this is installed) it does not permit network access. This can be easily
re-enabled (check the setup doc).
And never use SA as the application login account--and never post the
password anywhere.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
M

meerkat

Hello Bill - thanks for trying to help.
I installed SP3a but was unable to find any reference to re-enabling
network access, so, in desparation I uninstalled the Personal edition
and installed a Developer edition in its place. Still the same error.
Do I need to set permissions or users or something like that
somewhere? Any guidance would be much appreciated as I really need to
get this working soon. It should be really simple to fix shoudn't it?
After all I am not trying to do anything complicated at all.

Waiting hopefully,

Meerkat.
 
W

William \(Bill\) Vaughn

The first place to look for MSDE help is on the Microsoft Web Site.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/distsql/distsql_84xl.asp
has instructions about how to setup MSDE so that it can be seen across the
net.
DISABLENETWORKPROTOCOLS=n is the flag you want to set to enable MSDE to be
visible.
However, if you can use SQL Enterprise Manager from the Developer Edition to
see it from another system, it's already configured correctly. What
exceptions are you getting?

Also check out this article:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsql2k/html/sql_embeddingmsde.asp


--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
M

meerkat

OK Bill, I tried looking at the sites you mention but they didn't
help. However I have some more information that might give you a clue
where the problem might lie.

The first program was written on a machine that uses Framework V 1.1.
I then used a machine using Framework V 1.0. to write exactly the same
program, and it worked perfectly.

There is something about V 1.1 that is preventing the program from
working across a network. I assure you that there is no difference
between the program that works and the one that doesn't , except the
Framework version.

I would be extremely grateful if you ( or anyone else ) can tell me
what I need to do.

Yours,

Meerkat
 
W

William \(Bill\) Vaughn

Ok, let's see some code and the exact exception message that gets generated.
What does your connection string look like? What is the topology (how is the
network configured)? Is there a domain controller or is it a wires and hub
network?

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
M

meerkat

Ok, let's see some code and the exact exception message that gets generated.
What does your connection string look like? What is the topology (how is the
network configured)? Is there a domain controller or is it a wires and hub
network?

Hello again Bill,

Right let me see if I can give you everything you asked for.
I really hope you can spot what I need to do because this is driving
me nuts.

Regards, Meerkat.

I have two Windows 2000 machines networked together via a workgroup
and using a hub, there is no domain controller.

The exact error message is

-------------------------------
The application attempted to perform an operation not allowed by the
security policy. The operation required the SecurityException.
To grant this application the required permission please contact your
system administrator, or use the Microsoft .NET security policy
administration tool.

If you click Continue, the application will ignore this error and
attempt to continue. If you click Quit, the application will shut down
immediately.

Request for the permission of type
System.Data.SqlClient.SqlClientPermission, System.Data,
Version=1.0.5000.0, Culture=neutra,
PublicKeyToken=b77a5c561934e089 failed.
--------------------------------------


The two machines are called DELLONE and DELLTWO.
SQL Developer is installed on DELLONE.
DELLONE has VS 2003 using FRAMEWORK V 1.1
DELLTWO has VS 2002 using FRAMEWORK V 1.0

The following details are perhaps a bit complicated to follow but
basically what they are saying is that a program (TESTONE) which uses
FRAMEWORK v1.1, will not work across a my network

I wrote a program that runs the code shown at the end when a button is
pressed

I compiled this program on DELLONE and called it TESTONE
I compiled this program on DELLTWO and called it TESTTWO

I made a copy of TESTONE on DELLTWO
I made a copy of TESTTWO on DELLONE


After using the .net wizard, Trust an Assembly for all programs, I
then ran
TESTONE (on DELLONE) from DELLONE - OK
TESTTWO (on DELLONE) from DELLONE - OK
TESTONE (on DELLTWO) from DELLONE - SecurityException
TESTTWO (on DELLTWO) from DELLONE - OK

TESTONE (on DELLONE) from DELLTWO - SecurityException
TESTTWO (on DELLONE) from DELLTWO - OK
TESTONE (on DELLTWO) from DELLTWO - OK
TESTTWO (on DELLTWO) from DELLTWO - OK


Private Sub btnFillGrid_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnFillGrid.Click
Dim connStr As String = "user id=dummyid;pwd=dummypwd;data
source=DELLONE;initial catalog=Northwind"
Dim SQLcommand As String = "SELECT * from Customers"
Dim SqlConn As New SqlConnection(connStr)
SqlConn.Open()
Dim SqlDA As New SqlDataAdapter(SQLcommand, SqlConn)
Dim SqlDS As New DataSet("Customers")
SqlDA.Fill(SqlDS, "Customers")
DataGrid1.DataSource = SqlDS
DataGrid1.SetDataBinding(SqlDS, "Customers")
SqlConn.Close()
End Sub
 
W

William \(Bill\) Vaughn

Your problem has nothing to do with SQL Server. It has to do with Code
Access Security--which I don't know enough about to give advice.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
M

meerkat

Your problem has nothing to do with SQL Server. It has to do with Code
Access Security--which I don't know enough about to give advice.

Not to worry Bill - Thanks anyway - I will try reposting my problem.

Take care,

Meerkat.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top