<newbie>HELP!</newbie> 
Author Message
 <newbie>HELP!</newbie>

Hi,

I am very new to VB, and I have just has a DB project thrown at me.

I need to connect to a VB database, I can create the connection in the data
environment, but I have not got a clue how to use the connection in my
code...
I have a VB 6 training kit, but I cannot get the example code to run without
getting a message to the gist of "Illegal use of New function"
I try to create an SQL string that I want to submit to my MS SQL server
running on my remote server. This functions, and the SQL string is correct.
I just cannot figure a way to connect, to the server and submit my query in
VB. I'm using VB 6 under Windows 98 SE and Windows 2000 Pro. All networking
is functionning, and sql server is up and answering via Query Analyzer.

All constructive help appreciated - I am getting to the point of sacrificing
my boss to the god of computing for lack of support...

Cordially,

Daniel Page

My code below:

Private Sub Command1_Click()

Set cnHost = New Connection
Set rsHostss = New Recordset

uristring = hostname.Text
'The value of the entered text is in uristring.
sql = "select ip from hosts where uri =  """
sql = sql & uristring
sql = sql & """;"
'Chuck the query at the database
cnHost.Provider = "SQLOLEDB"
cnHost.ConnectionString = "User ID=hostuser;" & "Password=huser;" & "Data
Source=HISTDATA;" & "Initial Catalog=Hosts"
cnHost.Open
cnHost.CommandText = uristring

ipaddress.Text = rsHostss!ip

Print "Query submitted"



Fri, 12 Sep 2003 19:25:21 GMT  
 <newbie>HELP!</newbie>


Fri, 19 Jun 1992 00:00:00 GMT  
 <newbie>HELP!</newbie>
Correction - I need to connect VB to a database, and my net connections are
TCP/IP.

Cordially,

Daniel Page



Quote:
> Hi,

> I am very new to VB, and I have just has a DB project thrown at me.

> I need to connect to a VB database, I can create the connection in the
data
> environment, but I have not got a clue how to use the connection in my
> code...
> I have a VB 6 training kit, but I cannot get the example code to run
without
> getting a message to the gist of "Illegal use of New function"
> I try to create an SQL string that I want to submit to my MS SQL server
> running on my remote server. This functions, and the SQL string is
correct.
> I just cannot figure a way to connect, to the server and submit my query
in
> VB. I'm using VB 6 under Windows 98 SE and Windows 2000 Pro. All
networking
> is functionning, and sql server is up and answering via Query Analyzer.

> All constructive help appreciated - I am getting to the point of
sacrificing
> my boss to the god of computing for lack of support...

> Cordially,

> Daniel Page

> My code below:

> Private Sub Command1_Click()

> Set cnHost = New Connection
> Set rsHostss = New Recordset

> uristring = hostname.Text
> 'The value of the entered text is in uristring.
> sql = "select ip from hosts where uri =  """
> sql = sql & uristring
> sql = sql & """;"
> 'Chuck the query at the database
> cnHost.Provider = "SQLOLEDB"
> cnHost.ConnectionString = "User ID=hostuser;" & "Password=huser;" & "Data
> Source=HISTDATA;" & "Initial Catalog=Hosts"
> cnHost.Open
> cnHost.CommandText = uristring

> ipaddress.Text = rsHostss!ip

> Print "Query submitted"



Fri, 12 Sep 2003 19:26:40 GMT  
 <newbie>HELP!</newbie>


Fri, 19 Jun 1992 00:00:00 GMT  
 <newbie>HELP!</newbie>
You are better off not using the data environment.  Use ADO with OLE DB to
connect to SQL Server.

There is a bundle of sample code in MSDN.


Quote:
> Hi,

> I am very new to VB, and I have just has a DB project thrown at me.

> I need to connect to a VB database, I can create the connection in the
data
> environment, but I have not got a clue how to use the connection in my
> code...
> I have a VB 6 training kit, but I cannot get the example code to run
without
> getting a message to the gist of "Illegal use of New function"
> I try to create an SQL string that I want to submit to my MS SQL server
> running on my remote server. This functions, and the SQL string is
correct.
> I just cannot figure a way to connect, to the server and submit my query
in
> VB. I'm using VB 6 under Windows 98 SE and Windows 2000 Pro. All
networking
> is functionning, and sql server is up and answering via Query Analyzer.

> All constructive help appreciated - I am getting to the point of
sacrificing
> my boss to the god of computing for lack of support...

> Cordially,

> Daniel Page

> My code below:

> Private Sub Command1_Click()

> Set cnHost = New Connection
> Set rsHostss = New Recordset

> uristring = hostname.Text
> 'The value of the entered text is in uristring.
> sql = "select ip from hosts where uri =  """
> sql = sql & uristring
> sql = sql & """;"
> 'Chuck the query at the database
> cnHost.Provider = "SQLOLEDB"
> cnHost.ConnectionString = "User ID=hostuser;" & "Password=huser;" & "Data
> Source=HISTDATA;" & "Initial Catalog=Hosts"
> cnHost.Open
> cnHost.CommandText = uristring

> ipaddress.Text = rsHostss!ip

> Print "Query submitted"



Fri, 12 Sep 2003 20:58:38 GMT  
 <newbie>HELP!</newbie>
Richard,

Thank you for your input. I will start digging through our MSDN Cd's.

Cordially,

Daniel Page



Quote:
> You are better off not using the data environment.  Use ADO with OLE DB to
> connect to SQL Server.

> There is a bundle of sample code in MSDN.



> > Hi,

> > I am very new to VB, and I have just has a DB project thrown at me.

> > I need to connect to a VB database, I can create the connection in the
> data
> > environment, but I have not got a clue how to use the connection in my
> > code...
> > I have a VB 6 training kit, but I cannot get the example code to run
> without
> > getting a message to the gist of "Illegal use of New function"
> > I try to create an SQL string that I want to submit to my MS SQL server
> > running on my remote server. This functions, and the SQL string is
> correct.
> > I just cannot figure a way to connect, to the server and submit my query
> in
> > VB. I'm using VB 6 under Windows 98 SE and Windows 2000 Pro. All
> networking
> > is functionning, and sql server is up and answering via Query Analyzer.

> > All constructive help appreciated - I am getting to the point of
> sacrificing
> > my boss to the god of computing for lack of support...

> > Cordially,

> > Daniel Page

> > My code below:

> > Private Sub Command1_Click()

> > Set cnHost = New Connection
> > Set rsHostss = New Recordset

> > uristring = hostname.Text
> > 'The value of the entered text is in uristring.
> > sql = "select ip from hosts where uri =  """
> > sql = sql & uristring
> > sql = sql & """;"
> > 'Chuck the query at the database
> > cnHost.Provider = "SQLOLEDB"
> > cnHost.ConnectionString = "User ID=hostuser;" & "Password=huser;" &
"Data
> > Source=HISTDATA;" & "Initial Catalog=Hosts"
> > cnHost.Open
> > cnHost.CommandText = uristring

> > ipaddress.Text = rsHostss!ip

> > Print "Query submitted"



Fri, 12 Sep 2003 21:25:24 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. <<<<<<<<ComboBox>>>>>>>>>>>>

2. HELP >>>>>>WIN API <<<<<<<<<<

3. <><><>HELP<><><> PCMCIA Motorola Montana 33.6

4. help me out please!!!!<<<<<<<<<<<<<<<<<<<<<<<thanks>>>>>>>>>>>>>>>>>>>>>>>>

5. <<<<Newbie Setup Wizard problem>>>>>

6. >>>>HELP ME WITH DATEVALUE IN UK FORMAT<<<<<<<

7. <<<<HELP- OLE container Control>>>>>>>>>

8. VB5<->RDO2<->ODBC<->ORACLE Procedure Problem

9. <<<Cneck Box>>>

10. <<<Gif Files>>>

11. <<<CD ROM>>>

12. <<<Win32Api.TXT>>>

 

 
Powered by phpBB® Forum Software