Showing posts with label current. Show all posts
Showing posts with label current. Show all posts

Sunday, February 19, 2012

connection

Hello,

I'm getting the error below...

The connection was not closed. The connection's current state is open.

And heres the code thats casung the problem,...

publicstaticvoid JoinGroup(string GroupID,string User_ID)

{

SqlCommand cmd =newSqlCommand("insert into User_Joined_Groups (GroupID, User_ID) values (@.GroupID, @.User_ID)", conn);

conn.Open();

cmd.Parameters.Add(newSqlParameter("@.GroupID", GroupID));cmd.Parameters.Add(newSqlParameter("@.User_ID", User_ID));

cmd.ExecuteNonQuery();

conn.Close();

}

The method is called on a button click

anyone know what I've done wrong?

Thank you

Open your connection before using it when establishing your command. Also, make sure you have created your connection with the proper connection string before opening it:

public static void JoinGroup(string GroupID,string User_ID) {
conn =new SqlConnection(connStr);
conn.Open();SqlCommand cmd =new SqlCommand("insert into User_Joined_Groups (GroupID, User_ID) values (@.GroupID, @.User_ID)", conn); cmd.Parameters.Add(new SqlParameter("@.GroupID", GroupID));cmd.Parameters.Add(new SqlParameter("@.User_ID", User_ID)); cmd.ExecuteNonQuery();conn.Close();}

|||

champion!

Friday, February 17, 2012

connecting vb6 apps to sequel server 2005

We are currently migrating our sequel 6.5 databases to sequel 2005
We have a handful of vb6 apps that connect to the current 6.5 database.
Can anyone recommend the "best practice" for connecting vb6 apps to sequel 2005 databases ?
Thanks in advance.I dont find any difficulty in connection, still you can use the ADO connecting string to connect the server.

Connecting two servers

Hello there
After i create remote server on my current server i got an error:
Server 'Win2000Serv' is not configured for DATA ACCESS.
what can i do to solve it?Roy
exec sp_serveroption 'Win2000Serv' ,'data access','true'
"Roy Goldhammer" <roy@.hotmail.com> wrote in message
news:%23RfL8da9FHA.220@.TK2MSFTNGP14.phx.gbl...
> Hello there
> After i create remote server on my current server i got an error:
> Server 'Win2000Serv' is not configured for DATA ACCESS.
> what can i do to solve it?
>|||Hi,
sp_addlinkedserver
and
sp_addlinkedsrvlogin
:-)
Regards
--
Andy Davis
Activecrypt Team
---
SQL Server Encryption Software
http://www.activecrypt.com
"Roy Goldhammer" wrote:

> Hello there
> After i create remote server on my current server i got an error:
> Server 'Win2000Serv' is not configured for DATA ACCESS.
> what can i do to solve it?
>
>