Home All Groups Group Topic Archive Search About

Lost with creating a db connection... help!?

Author
26 Jun 2006 2:35 AM
ebrastow
Hi,

I've been using PowerBuilder for 12 years (programming part time) and
thought I might give VB a try. I'm using Visual Studio 2005,
specifically VB. My SQL Server is SQL Server 2000 Standard, running on
a W2K Server.

So, in VB, I create a new project, and then click Add New Data Source..

I choose Database as the data source type.

I choose New Connection...

The data source is "Microsoft SQL Server (SqlClient)"

I choose my SQL Server from the list of available servers, and then
choose SQL Server authentication.

I put in the user name and password for the database.

I choose the database from the drop down.

When I click Test, it succeeds.

Now, when I proceed, I get an error on the Choose Your Database Objects
screen:

--
An error occurred while retreiving information from the database.

Failed to retrieve data for this request.
An exception occurred while executing a Transact-SQL statement or
batch.
Line 8: Incorrect syntax near '1'.
--


Any ideas what I'm doing wrong? I'm just trying to create a connection
to the only db I'll be using in this app.

Thanks,

Evan

Author
26 Jun 2006 4:06 AM
GhostInAK
Hello ebrastow,

Your first mistake is using the IDE datasource crap.  I say crap because
it's the mildest word I can think of for that abortive hunk of junk.

I would (and do) create connections in code, like so:

Dim tConnection As SqlConnection = New SqlConnection(CONNECTION_STRING_HERE)
Dim tCommand As SqlCommand = New SqlCommand

With tCommand
    .Connection = tConnection
    .CommandType = Text
    .CommandText = "SELECT fields FROM table"
End With

Enjoy,
-Boo

Show quoteHide quote
> Hi,
>
> I've been using PowerBuilder for 12 years (programming part time) and
> thought I might give VB a try. I'm using Visual Studio 2005,
> specifically VB. My SQL Server is SQL Server 2000 Standard, running on
> a W2K Server.
>
> So, in VB, I create a new project, and then click Add New Data
> Source..
>
> I choose Database as the data source type.
>
> I choose New Connection...
>
> The data source is "Microsoft SQL Server (SqlClient)"
>
> I choose my SQL Server from the list of available servers, and then
> choose SQL Server authentication.
>
> I put in the user name and password for the database.
>
> I choose the database from the drop down.
>
> When I click Test, it succeeds.
>
> Now, when I proceed, I get an error on the Choose Your Database
> Objects screen:
>
> --
> An error occurred while retreiving information from the database.
> Failed to retrieve data for this request.
> An exception occurred while executing a Transact-SQL statement or
> batch.
> Line 8: Incorrect syntax near '1'.
> --
> Any ideas what I'm doing wrong? I'm just trying to create a connection
> to the only db I'll be using in this app.
>
> Thanks,
>
> Evan
>
Author
26 Jun 2006 12:40 PM
ebrastow
Hi Ghost,

Hmm... I will have to look into this. It bugs me that the wizard
doesn't work... there's nothing weird about my setup that would cause
it to error our, and I'd like to be sure my app is on stable ground,
you know?

What you're describing is how I used to make connections in
PowerBuilder. I assume it's similar in VB. I used to create a
transaction object and populate the various properties with the data
needed to connect, then, anytime I would need to use the db, I'd do it
through that object. Is that kind of where you're coming from?

Thanks,

Evan


GhostInAK wrote:
Show quoteHide quote
> Hello ebrastow,
>
> Your first mistake is using the IDE datasource crap.  I say crap because
> it's the mildest word I can think of for that abortive hunk of junk.
>
> I would (and do) create connections in code, like so:
>
> Dim tConnection As SqlConnection = New SqlConnection(CONNECTION_STRING_HERE)
> Dim tCommand As SqlCommand = New SqlCommand
>
> With tCommand
>     .Connection = tConnection
>     .CommandType = Text
>     .CommandText = "SELECT fields FROM table"
> End With
>
> Enjoy,
> -Boo
>
> > Hi,
> >
> > I've been using PowerBuilder for 12 years (programming part time) and
> > thought I might give VB a try. I'm using Visual Studio 2005,
> > specifically VB. My SQL Server is SQL Server 2000 Standard, running on
> > a W2K Server.
> >
> > So, in VB, I create a new project, and then click Add New Data
> > Source..
> >
> > I choose Database as the data source type.
> >
> > I choose New Connection...
> >
> > The data source is "Microsoft SQL Server (SqlClient)"
> >
> > I choose my SQL Server from the list of available servers, and then
> > choose SQL Server authentication.
> >
> > I put in the user name and password for the database.
> >
> > I choose the database from the drop down.
> >
> > When I click Test, it succeeds.
> >
> > Now, when I proceed, I get an error on the Choose Your Database
> > Objects screen:
> >
> > --
> > An error occurred while retreiving information from the database.
> > Failed to retrieve data for this request.
> > An exception occurred while executing a Transact-SQL statement or
> > batch.
> > Line 8: Incorrect syntax near '1'.
> > --
> > Any ideas what I'm doing wrong? I'm just trying to create a connection
> > to the only db I'll be using in this app.
> >
> > Thanks,
> >
> > Evan
> >
Author
26 Jun 2006 4:58 AM
Cor Ligthert [MVP]
ebrastow,

Did you already try it with not using the SQLServer password but just the
integrated security checkbox.

Normally that wizard is in version 2005 great.

Cor

Show quoteHide quote
"ebrastow" <ebras***@automatedemblem.com> schreef in bericht
news:1151289348.300860.232340@i40g2000cwc.googlegroups.com...
> Hi,
>
> I've been using PowerBuilder for 12 years (programming part time) and
> thought I might give VB a try. I'm using Visual Studio 2005,
> specifically VB. My SQL Server is SQL Server 2000 Standard, running on
> a W2K Server.
>
> So, in VB, I create a new project, and then click Add New Data Source..
>
> I choose Database as the data source type.
>
> I choose New Connection...
>
> The data source is "Microsoft SQL Server (SqlClient)"
>
> I choose my SQL Server from the list of available servers, and then
> choose SQL Server authentication.
>
> I put in the user name and password for the database.
>
> I choose the database from the drop down.
>
> When I click Test, it succeeds.
>
> Now, when I proceed, I get an error on the Choose Your Database Objects
> screen:
>
> --
> An error occurred while retreiving information from the database.
>
> Failed to retrieve data for this request.
> An exception occurred while executing a Transact-SQL statement or
> batch.
> Line 8: Incorrect syntax near '1'.
> --
>
>
> Any ideas what I'm doing wrong? I'm just trying to create a connection
> to the only db I'll be using in this app.
>
> Thanks,
>
> Evan
>
Author
26 Jun 2006 12:37 PM
ebrastow
Hi Cor,

Yes, I just tried using integrated security, and I got the same result.
I would have actually been surprised if that had worked, because the
database is set for SQL Server security. Somehow, though, I don't think
security is the problem given the error message I'm getting.

I can't imagine what's going on with it but I'll keep trying...

Thanks,

Evan


Cor Ligthert [MVP] wrote:
Show quoteHide quote
> ebrastow,
>
> Did you already try it with not using the SQLServer password but just the
> integrated security checkbox.
>
> Normally that wizard is in version 2005 great.
>
> Cor
>
> "ebrastow" <ebras***@automatedemblem.com> schreef in bericht
> news:1151289348.300860.232340@i40g2000cwc.googlegroups.com...
> > Hi,
> >
> > I've been using PowerBuilder for 12 years (programming part time) and
> > thought I might give VB a try. I'm using Visual Studio 2005,
> > specifically VB. My SQL Server is SQL Server 2000 Standard, running on
> > a W2K Server.
> >
> > So, in VB, I create a new project, and then click Add New Data Source..
> >
> > I choose Database as the data source type.
> >
> > I choose New Connection...
> >
> > The data source is "Microsoft SQL Server (SqlClient)"
> >
> > I choose my SQL Server from the list of available servers, and then
> > choose SQL Server authentication.
> >
> > I put in the user name and password for the database.
> >
> > I choose the database from the drop down.
> >
> > When I click Test, it succeeds.
> >
> > Now, when I proceed, I get an error on the Choose Your Database Objects
> > screen:
> >
> > --
> > An error occurred while retreiving information from the database.
> >
> > Failed to retrieve data for this request.
> > An exception occurred while executing a Transact-SQL statement or
> > batch.
> > Line 8: Incorrect syntax near '1'.
> > --
> >
> >
> > Any ideas what I'm doing wrong? I'm just trying to create a connection
> > to the only db I'll be using in this app.
> >
> > Thanks,
> >
> > Evan
> >