Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / January 2006

Tip: Looking for answers? Try searching our database.

Connection SQL server

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Souris - 14 Jan 2006 10:51 GMT
I wnated to write a connection to my SQL server, but I got fail.
The folowing is my code.

Can you please tell me where I am wrong?

<%
set conn = Server.CreateObject("ADODB.Connection")
set cmd = Server.CreateObject("ADODB.Command")

sConnString = "Provider=SQLOLEDB.1;User ID=Test1;password=Test1;Initial
Catalog=MyDataBase;Data Source = MyServer"

Conn.Open sConnString
Set cmd.ActiveConnection = Conn
cmd.CommandText = "SELECT * FROM Client"
cmd.CommandType = adCmdText

Set rs = cmd.execute

Do While Not rs.EOF
  For iCtr = 0 To rs.fields.Count - 1
    response.write rs.fields(iCtr).Name & ": "
     response.write rs.fields(iCtr).Value & "<BR>"
   Next
rs.MoveNext
Loop
Set rs = Nothing
Set cmd = Nothing
Conn.Close
set conn = nothing

Your information is great appreciated,

I got error message on
"Set cmd.ActiveConnection = Conn"

Error message is following:

Error Type:

ADODB.Command (0x800A0BB9)
Arguments are of the wrong type, are out of acceptable range, or are in
conflict with one another
john smith - 14 Jan 2006 20:14 GMT
> I wnated to write a connection to my SQL server, but I got fail.
> The folowing is my code.
[quoted text clipped - 39 lines]
> Arguments are of the wrong type, are out of acceptable range, or are in
> conflict with one another

You might get more relevant replies by posting in the correct newsgroup.
This is not web services related, nor asp.net related, or even .net
related in any way...

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.