Showing posts with label cnet. Show all posts
Showing posts with label cnet. Show all posts

Monday, 19 March 2012

connect SQL server 2000 with c#.net .....?Full code

Hello masters,

help me yaar

i am using dotnet 2003 and SqL SERVER 2000. BUT UNABLE TO CONNECT DATABASE using dataAdaptor(design time ) or sqlconnection any can help me

gs

whats the error?

lets see the connection string.

make an empty text file called "c:\test.udl" - double click it and try to build a SQL Ole Db Provider datalink. . . can you get that to work?

Are the TCP protocols enabled in your machines client network settings and in the servers network settings?

|||Guess you don′t have the right connection string, look at www.connectionstrings.com for appropiate connection strings.

HTH, jens Suessmeyer.|||

hi i am using this code it dose not show any error as well as no output... please check it...

string conn = ("Data Source=localhost;"+

"Initial Catalog=gstest;"+

"User ID=sa;"+

"Password=logic;");

SqlConnection con = new SqlConnection();

con.ConnectionString = conn;

SqlDataAdapter da = new SqlDataAdapter("select * from tb1",con);

DataSet ds = new DataSet();

da.Fill(ds,"tb");

dataGrid1.DataSource = ds.DefaultViewManager;

|||

hello i got this error now,

what to do?

An unhandled exception of type 'System.InvalidOperationException' occurred in system.data.dll

Additional information: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.

|||

If this is a web project (?!) you have to rebind the grid to the data

dataGrid1.DataBind()

HTH, jens Suessmeyer.

|||

what does this do:

try
{
DataSet ds = new DataSet();
string conn = "Data Source=localhost;Initial Catalog=gstest;User ID=sa;Password=logic;";
using(SqlConnection con = new SqlConnection(conn))
{
using(SqlDataAdapter da = new SqlDataAdapter("select * from tb1",con))
{
da.Fill(ds);
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}

|||

hi master

it display...

Sql server dose not exist or access denied

but my sql server is running ......?

|||The using statement is doing garbage collection after the scope is funished. Fills your dataset like the first statement.

HTH, Jens Suessmeyer.|||

Jens Suessmeyer wrote:

Guess you don′t have the right connection string, look at www.connectionstrings.com for appropiate connection strings.

HTH, jens Suessmeyer.

the connection string is properly formed. whether that user/pw is correct and has permissions is another story.

Is the sql server on your development machine?

on the client, check that the TCP protocols are enabled using the Client Network Utility (cliconfig.exe) and on the server there is the Server Network Utility (svrnetcn.exe)

got windows firewall on? might try turning that off.

look at services control panel applet connected to the server.

does it show:

MSSQL or MSSQLSERVER

is it running?

|||Like it says "..or access denied". Whether you are not a default instance, then you have to suffix the instance name after the servername like localhost/instancename or you use a different port than the standard port then you have to add the port after the instancename servername/instance,Port ot you have a security problem, that the password is not valid for the sa account.

HTH, jens Suessmeyer.|||

still suffring

MSSQLSERVER is running on my pc i have also turn off the fire wall.

but the error is the same.

i like to know that after installing sql server is any process to configure with dotnet2003

if there is any pls inform me.....

pls.............

|||

Can you use integrated authentication ? If so (and you are in the adminstrative group, which should be server administrator by default int the installation) try using instead of UserID=yadayada;Password=blabla --> "Integrated Security=true"

HTH, Jens Suessmeyer-

|||

no, not really. . . did you check these:

Client Network Utility (cliconfig.exe) and Server Network Utility (svrnetcn.exe)

to make sure the tcp protocols are started?

did you make that empty udl file to check if Datalinks could connect?

|||

i am working on windows 2000 prof O/S

i have just downloaded the sqlserver 2000 form the net for installing this i have used the command in dos prompt...

C:\Program Files\Microsoft Visual Studio .NET 2003\Setup\MSDE\setup sapwd=logic securitymode=sql

after this sql server is installed in my computer and then i have downloded the Database manager(trial verson) to create the database and the tabels.

using this database and the tabels are created but

i am not able to connecte using dotnet2003

and pls tell me how to check the...

Client Network Utility (cliconfig.exe) and Server Network Utility (svrnetcn.exe)

to make sure the tcp protocols are started?