SQLConnection, Please help me.

G

Guest

This is related to a post below but is a new issue.

I have created a SQLDataAdaptor from the config wizard and set my
SQLConnection1 in same wizard. I then gerated a dataset from my adaptor as
all the notes tell you to do.

I load the form and code the following to see if the connection is open.

Try
MessageBox.Show(SqlConnection1.State.ToString) -- closed
SqlConnection1.Open()
MessageBox.Show(SqlConnection1.State.ToString) -- fails with ex as below
SqlDataAdapter2.Fill(DataSet11)
dgThreshold.DataSource = DataSet11.DefaultViewManager
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try

ex returns as (even though the TEST Connection button worked and you can see
it's connected vis the server explorer)

System.Data.SqlClient.SQLException: Login failed for user 'sa'.
at System.Data.SqlClient.ConnectionPool.GetConnection(Boolean&
isInTransaction)
at System.Data.SqlClient.SQLConnectionPoolManager.GetPooledConnection
(SqlConnection String options, Boolean& isInTransaction)
at System.Data.SqlClient.SqlConnection.Open()
at MIS_RECON_Engine.Thresholds.Thresholds_Load(object sender, EventArgs e)
in C:\Documents and settings.....Thresholds.vb:Line 349
 
G

Guest

When defining the dataAdaptor connection part, the default is to Don't
include password which i chose thinking that it would star out my password
but oh no, it literally does NOT use it....strange & stupid because how else
are you meant to connect!!!!
 
M

Marina Levit [MVP]

It can't star it out - it would need the actual password to connect. And
that's gotta go somewhere in code - which means having it in plain text in
the source code - which would be a security risk.
 
G

Guest

yes but it cannot connect without it and it defaults to 'do not include
password'.
human computer interaction mark of a big fat zero.
 

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