Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Mar 31st, 2005, 12:26 PM   #1
Gapper
Newbie
 
Join Date: Mar 2005
Location: Ireland
Posts: 5
Rep Power: 0 Gapper is on a distinguished road
Thumbs up sql connection problem

connection string

cnn.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=ChessnutsDB;Data Source=GAPPER;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=GAPPER;Use Encryption for Data=False;Tag with column collation when possible=False"

*
keeps returning

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

Additional information: Keyword not supported: 'provider'.
*
whats the problem
Gapper is offline   Reply With Quote
Old Apr 7th, 2005, 9:21 PM   #2
new User(Kevin.Parkinson)
Programmer
 
new User(Kevin.Parkinson)'s Avatar
 
Join Date: Mar 2005
Location: Edmonton, Alberta, Canada
Posts: 37
Rep Power: 0 new User(Kevin.Parkinson) is on a distinguished road
Send a message via MSN to new User(Kevin.Parkinson)
Exclamation

Grapper:
What I think you r problem is, is that you included the "Provider=" when you don't need to do in .NET( I remember this from previous versions of ADO though ) given that the connection you created is a SqlConnection. I am not sure about all the extra arguments you have in there, but I found a code sample on MSDN

public void CreateSqlConnection() 
 {
    SqlConnection myConnection = new SqlConnection();
    myConnection.ConnectionString = "Persist Security Info=False;"
          + "Integrated Security=SSPI;database=northwind;"
          + "server=mySQLServer;Connect Timeout=30";
    myConnection.Open();
 }
code excerpt taken from http://msdn.microsoft.com/library/de...tringtopic.asp

I hope that helps you out.
__________________
public class  MySignature extends Post implements JavaSyntax throws NuttinHoney{
     MySignature()
     {
          Salutation();
          Name();
     }
     
     public string  Salutation()
     {
          Screen.printLn( "Sincerely,\n" );
     }
     
     public string  Name()
     {
          Screen.printLn( "Kevin Parkinson" );
     }
}
new User(Kevin.Parkinson) is offline   Reply With Quote
Old Apr 21st, 2005, 1:53 AM   #3
Bharathi
Programmer
 
Join Date: Apr 2005
Posts: 32
Rep Power: 0 Bharathi is on a distinguished road
Solution for Connection problem

Hi,


To retrieve data from the database using Data Reader and Data Commands. When this code is executed, the data in a database is displayed in two textbox controls.

Preparation:

Design a form using .NET environment and place two textbox controls on a form.
Design and create a table using SQL Server 2000.

Name the Database as FinAccounting.
Name the Table as AccountsTable.
Name the form as Form1
Name the controls on the form as Textbox1 and Textbox2.

Tasks:

1. Establish the connection with the Database using Connection object.
2. Execute the command.
3. The data will be read by the Datareader object and the contents of the first record is displayed in the textboxes.

Imports System.Data.SqlClient
Public Class Form1
Inherits System.Windows.Forms.Form
Dim str_sql_user_select As String = “SELECT * FROM AccountsTable”
Dim str_connection As String = “Data Source=VSDOTNET;Integrated Security=SSPI;Initial Catalog=FinAccounting”
Dim mycon As SqlConnection
Dim comUserSelect As SqlCommand
Dim myreader As SqlDataReader

Private Sub Form1_Load(ByVal sender As Object, ByVal e As system.EventArgs) Handles
MyBase.Load
mycon = New SqlConnection(str_connection)
‘Instantiate the commands
comUserSelect = New SqlCommand(str_sql_user_select, mycon)
TextBox1.Text = “ “
TextBox2.Text = “ “
mycon.Open()
myreader = comUserSelect.ExecuteReader
If (myreader.Read = True) Then
TextBox1.Text = myreader(0)
TextBox2.Text = myreader(1)
Else
MsgBox(“You have reached eof”)
End If
End Sub
End Class

This code works for Vb.net.

Log on to : http://www.vkinfotek.com

Application Series Books teach the reader how to develop an accounting package for a client server network. These books also teach all the secrets and logics required to develop an accounting package.
Bharathi is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 10:52 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC