SqlClient Vs OLEDb
Feb 29, 2008
I am porting a VB.NET application using Access as its backend to use SQL Express as its new backend.
The application uses .NET 2.0 OleDbProvider to connect to the database.
The porting of the database itself to Sql Express is nearly complete, now I need to modify the application.
So, does it really make sense to modify it to use Native Sql Client instead of OleDb in terms of effort & benefits???
Moreover, if I continue using OleDb, would I need to make such small changes to embedded Sql statements like using single quotes around strings or dates instead of double quotes or pound symbols that are currently being used for String or date data respectively???
View 4 Replies
ADVERTISEMENT
Mar 6, 2005
Hi.
Somewhere around I find a message, which affirmed that for perfonmance it is better to use OleDb for SQL 6.5. Is this true?.
Then el SqlClient, only have perfomance in SQL 2000?
View 1 Replies
View Related
Oct 10, 2006
Hi all,
I got an error when i do an OLE db Source pointing to an sql 2000 database and executing a sql query inside the OLE Source. The ole source will point to an OLE DB destination which is an sql 2005 database.
But i got the below error:
Error at Data Flow Task [OLE DB Destination [245]]: the column firstname cannot be processed because more than one code page (936 and 1252) are specified for it.
Error at Data Flow Task [DTS.Pipeline]: "component "OLE DB destination" (245)" failed validation and returned validation status "VS_ISBROKEN".
Error at Data Flow Task [DTS.Pipeline]: One or more component failed validation.
Error at Data Flow TaSK: There were errors during task validation.
(Microsoft.DataTransformationServices.VsIntegration)
View 5 Replies
View Related
May 17, 2006
Hi Experts
I'm facing a weird problem with asp.net application and windows 2000 based client PC having IE 6.0 SP1, i have asp.net web application which have a form that have a facility to search for customer using its ID and application will bring the data from the database that record and users will be able to update the record.
Once updated, then i just want to query data for same customer id, application is not bringing updated record from the database but it showing the old record and once the IE closed and reloaded then it shows the correct record.
The same feature works fine, under windows xp machine having IE 6.0 SP2, that proves that there is no problem with my application or code but its windows 2000 client having problem.
I tried to update the windows 2000 machine with all the patches from microsoft but no success same problem.
Any help on this issue will much appreciated.
Regards
Bhavesh
View 2 Replies
View Related
Jul 24, 2007
Hi guys,
Since the project that i'm developing is rapidly increasing, the pages seems to be getting slower everytime you view it. I would like to ask if code below would be efficient enough for several simultaneous request of data or if you have any other suggestions, you are welcome to add:
1 Public Shared Function QueryDatabase(ByVal sql As String) As DataTable2 3 ' SQL Server Connection Object Variable4 Dim _oConnection As SqlConnection5 ' SQL Server Command Object Variable6 Dim _oCommand As SqlCommand7 ' SQL Server Data Adapter Object Variable8 Dim _oAdapter As SqlDataAdapter9 ' DataTable Object Variable (Early Binding)10 Dim _oDataTable As New DataTable11 12 ' Instantiate Connection Object with connection string13 _oConnection = New SqlConnection("Data Source=XXX.XXX.XXX.XXX;Initial Catalog=XXXXXX;User=XXX;Pwd=XXX;")14 ' Instantiate Command Object with SQL String and Connection Object15 _oCommand = New SqlCommand(sql, _oConnection)16 ' Instantiate Data Adapter Object with Command Object17 _oAdapter = New SqlDataAdapter(_oCommand)18 ' Fill the DataTable Object with the retrieve records19 _oAdapter.Fill(_oDataTable)20 21 ' Release resources used by DataAdapter Object22 _oAdapter.Dispose()23 24 ' Release resources used by Command Object25 _oCommand.Dispose()26 27 ' Close the connection of the Connection Object from SQL Server28 _oConnection.Close()29 30 ' Release resources used by Connection Object31 _oConnection.Dispose()32 33 ' Return the retrieve records34 Return _oDataTable35 36 End Function Thanks a lot.
View 2 Replies
View Related
Mar 4, 2008
Hi All: I'm having problems creating a data connection between a windows 2000 server running .net 2.0 and a sql2005 server (server2003). I'm trying to create a connection in VWD2005 express, and when I use the visual wizard, I get a connection error with something about "named pipes" when I'm trying to connect using an alias on the server that uses tcp/ip (the alias is created in cliconfg).
If I click on "advanced properties" in the connection, and I select "TCP/IP" for the Network Library, what's displayed is "TCP/IP (DBMSGNET)" ...but shouldn't it say "DMBSSOCN"?
I'm wondering if this is correct, or a cosmetic bug in the .net sqlclient GUI, or indicative of any underlying problem that's preventing me from creating the connection?
If I manually override the connection string in web.config by entering "Network Library: DBMSSOCN", I still can't connect, getting a timeout error that the sql2005 server is not responding. But I know the server is working properly, with other .NET DB connections working within the same application...so I'm thinking this must be a problem with VWD and/or the .net framework on my local computer (not the server)?
I don't know where to begin to look to debug this problem?
View 2 Replies
View Related
Aug 14, 2007
OK, I am an dinosaur, I am still using ASP.NET 1.1 with an MS Access database. However, I am being forced to upgrade from Access to SQL Server. I have converted the Access database using the Access Upsize wizard and everthing went fine. When I go into my ASP.NET app the Database shows up fine and I can list the data with no problems.
When I try to open the new data base in the code behind I get the following error: System.Data.SqlClient.SqlException: Login failed for user 'WIRELESSINFOASPNET"
Where the WIRELESSINFO is the name of my server. I have checked the permissions on the SQL Server directory and Sub directories where the actual data tables are located and the ASPNET Machine Account (WIRELESSINFOASPNET) has full control. Can anyone help out on this. Thanks, Art
View 4 Replies
View Related
Sep 22, 2007
i have installed visual express and sql express.
but the problem is i want to add the connection string manuallty in visual studio express 2005.
so i want to add a reference of sql.data.sqlclient but could not add ?
i am not sure what is the problem or is am i missing anything
View 7 Replies
View Related
Feb 1, 2008
I am not able to add the namespace "system.data.SqlClient" and not able to get the intellisense for sqlconnections. I have only vs2005. i do not have sql management express
or sql server 2005
View 16 Replies
View Related
May 15, 2008
hi, I want to work with a recordset/cursor with sqlserver sqlclient, I have a sqlconnection and sqlcommand, I need to scroll forward and back.
View 1 Replies
View Related
Jan 17, 2008
Hi,
Can I use SqlCe v3.1 and SqlClient v2.0 in one .net application? (Note: I can't use RDA or replication. SqlClient read and write data in ON-LINE mode, SqlCe store and manipulate with data in OFF-LINE mode.)
View 4 Replies
View Related
Apr 16, 2008
I'm running into a blocking problem on my SQL 2000 server. I have a table that is frequently read/written to (inserts, updates, deletes) -- I don't place any explicity locks but I do a SELECT @@Identity after I insert a record to get the Identity value via a sqlCommand.ExecuteScalar.
So my questions:
#1 Is blocking normal? (40-90 blocks consistantly - 350 or so client connections)
#2 Is there any better coding solution to avoid blocks?
#3 I need to get the Identity value after the recorded is added and I thought ExecuteScalar is the fastest and least overhead, put perhaps I'm wrong?
Any suggestions or hints welcome.
Thanks, Rob.
.NET 2.0
View 4 Replies
View Related
Oct 14, 2005
Hi,
I've been doing some work with nested TransactionScope classes and timeouts and I'm getting some strange results that I can't quite explain. I'm hoping that I've done something foolish in my code, since that will be by far the easiest fix :)
The scenario is that I have a stored procedure that may block indefinately (arguably not great, but it's outside of my control) - in the example below, it does a simple "waitfor" to pause for 3 seconds. There is a intermediate data layer between my application code and the database that wraps all database calls in a TransactionScope (essentially the ExecCommand method in the example). At the application layer, we create a TransactionScope with a timeout, then call into the data layer to perform the query (the application layer is the Main method in the example).
The behaviour I'm seeing is that the initial call will block within SQL Server until the current executing SQL command completes (in this case, the waitfor). At that point, the batch is terminated and control returns to the C#. Within the C# there are no errors until the outer TransactionScope is disposed; the only apparent way of detecting that the batch didn't complete is to examine the Transaction.Current.TransactionInformation.Status property. I can just about live with that (although would have prefered that the ExecuteNonQuery had thrown); the example checks this status property and throws an exception if it's bad.
So far, so good. It all goes very wrong if I attempt to make another call. If the connection has the "connection reset" property set to false, then the second call fails immediately with a "transaction in doubt" error. If the "connection reset" property is set to true, then the second call completes successfully, except the database doesn't get called! (In profiler, you see the exec os sp_reset_connection, but that's all). It all looks as if I've not tidied up properly, but I'm not sure what I've missed. To add some spice, putting a 1 second sleep before the Execute makes everything work as expected.
The sample code is below; sorry if it's a little large. There a connection string right at the top that you may need to tweak. It creates a stored procedure in the initial catalog; see line 95 for details - it's nothing offensive! The sample compiles just fine from the command line with no special options needed.
Finally, I'm running .Net v2.0.50727 and the Sept. CTP of SQL Server 2005.
Here's hoping someone can tell me what I've done wrong!
Cheers,
Steve
using System;
View 2 Replies
View Related
Feb 19, 2004
Hi All,
I am new to ASP.NET and trying to learn. I am getting the problem when I try to insert data into SQL. The exception that I am getting is
Exception Details: System.Data.SqlClient.SqlException: An explicit value for the
identity column in table 'Customers' can only be specified when a column list is used and IDENTITY_INSERT is ON.
My table name is 'Customers' and its as below.
-----------------------------------------------------------------------
CustomerID--numeric---Identity Seed is 1000---Identity Increment is 1---No Nulls.
Name--------varchar---No Nulls.
address------Varchar---No Nulls.
State--------Varchar---No Nulls.
Zip-----------VarcHar---No Nulls.
PhoneNumber-Varchar---No Nulls.
Email---------Varchar---No Nulls.
and my code is (No fun of my code please--I am a learner)
-----------------------------------------------------------------------
Imports System.Data
Imports System.Data.SqlClient
Public Class register
Inherits System.Web.UI.Page
Protected WithEvents cnNWind As SqlConnection
'Protected drCustomers As SqlDataReader
Protected WithEvents lbladd As System.Web.UI.WebControls.Label
Protected WithEvents lblState As System.Web.UI.WebControls.Label
Protected WithEvents lblcity As System.Web.UI.WebControls.Label
Protected WithEvents lblzip As System.Web.UI.WebControls.Label
Protected WithEvents lblPhone As System.Web.UI.WebControls.Label
Protected WithEvents lblEmail As System.Web.UI.WebControls.Label
Protected WithEvents TxtName As System.Web.UI.WebControls.TextBox
Protected WithEvents txtAdd As System.Web.UI.WebControls.TextBox
Protected WithEvents txtState As System.Web.UI.WebControls.TextBox
Protected WithEvents txtCity As System.Web.UI.WebControls.TextBox
Protected WithEvents txtZip As System.Web.UI.WebControls.TextBox
Protected WithEvents txtPhone As System.Web.UI.WebControls.TextBox
Protected WithEvents TxtEmail As System.Web.UI.WebControls.TextBox
Protected WithEvents BtnSubmit As System.Web.UI.WebControls.Button
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
End Sub
Private Sub BtnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnSubmit.Click
cnNWind = New SqlConnection()
cnNWind.ConnectionString = "Data Source=(local); Initial Catalog=cart; Integrated Security=SSPI"
cnNWind.Open()
If cnNWind.State = ConnectionState.Open Then
Dim cmCustomers As New SqlCommand("INSERT INTO Customers VALUES ('',' " & TxtName.Text & "','" & txtAdd.Text & "','" & txtState.Text & "','" & txtZip.Text & "','" & txtPhone.Text & "','" & TxtEmail.Text & "')", cnNWind)
cmCustomers.ExecuteNonQuery()
cmCustomers.ExecuteNonQuery()
cnNWind.Close()
End If
End Sub
End Class
The Error I am getting:
-----------------------------------------------------------------------
Server Error in '/SCart' Application.
--------------------------------------------------------------------------------
An explicit value for the identity column in table 'Customers' can only be specified when a column list is used and IDENTITY_INSERT is ON.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: An explicit value for the identity column in table 'Customers' can only be specified when a column list is used and IDENTITY_INSERT is ON.
Source Error:
Line 46: If cnNWind.State = ConnectionState.Open Then
Line 47: Dim cmCustomers As New SqlCommand("INSERT INTO Customers VALUES ('','" & TxtName.Text & "','" & txtAdd.Text & "','" & txtState.Text & "','" & txtZip.Text & "','" & txtPhone.Text & "','" & TxtEmail.Text & "')", cnNWind)
Line 48: cmCustomers.ExecuteNonQuery()
Line 49: cnNWind.Close()
Line 50: End If
Source File: d:inetpubwwwrootSCart
egister.aspx.vb Line: 48
Stack Trace:
[SqlException: An explicit value for the identity column in table 'Customers' can only be specified when a column list is used and IDENTITY_INSERT is ON.]
System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
SCart.register.BtnSubmit_Click(Object sender, EventArgs e) in d:inetpubwwwrootSCart
egister.aspx.vb:48
System.Web.UI.WebControls.Button.OnClick(EventArgs e)
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573
The code works fine If I Dont use Identity Column, But I need to use Identity Column in my Project :( ...Please Help.
View 4 Replies
View Related
Dec 12, 2005
Well, I hope, after my endless search in the web... maybe, somebody can help me here.I'm passing a application to a web-based application, therefore I have to use ADO.net to access a sql server DB. But the performance is extremly poor!!!!Just to compare: with the normal application or with the SQL Query Analyzer, the query needs about 2 seconds. Well, by using ado.net, it's about 200 seconds......!!!!Of course, the query is quite long. But the difference is extrem... too extrem for using the same query....I already tried a lot... actually everything I found on the web. What is really strange is that neither the processor nor the memory is fully used... And the web server use more of the cpu power than the sql server itself (the 2 server are still on my machine where I'm programming). So, could it be that the problem is by filling up the dataset with the sqladapter or something similar?Thx for your help!!
View 8 Replies
View Related
Jun 26, 2007
Hello,
I created a .NET program that uses SQL Express on a Win 2003 server. I can use the database with no problem, but other domain users get an SQLClient error 4060 when trying to use the database. The connection string uses Windows authentication.
What permissions do I need to set to allow domain users to use the database?
(I put this question in the SQL Express forum and did not get a valid answer.)
Thanks for any ideas,
Tom
View 4 Replies
View Related
Apr 14, 2007
I'm trying to retrieve an image from my ms sql server 2005, and i'm using VS2005....however, i have the following error during the compilation process Code in webform2.aspx.vb:Partial Class webform2 Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim connstr As String = "Data Source=DCPRJ007SQLEXPRESS;Initial Catalog=mydatabase;Integrated Security=True" Dim cnn As New Data.SqlClient.SqlConnection(connstr) Dim cmd As New Data.SqlClient.SqlCommand("select * from dbo.images where id=" & Request.QueryString("id"), cnn) cnn.Open() Dim dr As Data.SqlClient.SqlDataReader = cmd.ExecuteReader() Dim bindata() As Byte = dr.GetValue(1) Response.BinaryWrite(bindata) End SubEnd Class System.Data.SqlClient.SqlException was unhandled by user code Class=15 ErrorCode=-2146232060 LineNumber=1 Message="Incorrect syntax near '='." Number=102 Procedure="" Server="DCPRJ007SQLEXPRESS" Source=".Net SqlClient Data Provider" State=1 StackTrace: at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlDataReader.ConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader() at webform2.Page_Load(Object sender, EventArgs e) in C:Documents and SettingsAdministratorMy DocumentsVisual Studio 2005WebSitesWebSite7webform2.aspx.vb:line 10 at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
View 4 Replies
View Related
Nov 7, 2007
im getting this error when i try to access the application from the network. but in my computer work fine
Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
please help... thanxs
View 6 Replies
View Related
Mar 10, 2008
This is a part of my project and that are my first steps. I just want to know if there is a user with "username" already in the database. The MSDN Documentation says that the ExecuteNonQuery() Method returns the number of affected rows. But if I run this code I always get x=-1. What does that mean ?
using (SqlConnection sqlcon = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["web_db_1"].ConnectionString)) { SqlCommand cmd = new SqlCommand("Select user_id From users Where username = '" + username + "'", sqlcon); cmd.CommandType = CommandType.Text; cmd.Connection.Open(); int x = cmd.ExecuteNonQuery(); cmd.Connection.Close(); }
Thanks,
Party-Pansen
View 5 Replies
View Related
Jul 2, 2006
Hi,
I had make one Desktop application in VB.net, having 6 threads simultaneously running. And each thread connect to sql server and stored the value in DB at every one second. Now my problem is that when I start the application its working fine but after 20-30 minutes exception is occuring.
Login failed for user 'sa'.
Exception StackTrace:
at System.Data.SqlClient.ConnectionPool.CreateConnection()
at System.Data.SqlClient.ConnectionPool.PoolCreateRequest(Object state)
can anybody help me
- Hiren
View 1 Replies
View Related
Jul 12, 2006
I download the DAAB CF version. However, most of them use SQLCEClient to connect to the database. Is there any DAAB that use SQLClient?
One workaround that I made is I replaced all SQLCEClient objects with the SQLClient objects. I only test one method "ExecuteDataset" and it works so far. However, my question is "does my workaround a good solution?"
Thanks,
Hendra
View 1 Replies
View Related
Jul 13, 2006
Hi All,
I have a form (asp website with the default.aspx and default.aspx.cs) which I use to connect to the SQL Server 2005 database and insert, update,get and delete data to and from it. In the table I have a column called Picture to insert a photo (usually bmp files) which I declared as a varbinary(max). ID is the primary key and is an int (i tried it to be numeric & varchar).
I am trying to insert data into the table using a form with this syntax:
SqlConnection enter_conn = new SqlConnection("user id=;" +
"password=;server=servername;" +
"Trusted_Connection=yes;" +
"database=Member Profiles; " +
"connection timeout=30");
enter_conn.Open();
string insertSql = "Insert dbo.Details(ID,Last_Name,First_Name,Middle_Initial,Project, Organization,Manager,Current_Skills,Biography,Hobbies, Picture) Select 1001, 'ABC','XYZ','R',' Website Development','ACT',LKM','ASP.Net, C#.Net, SQL Server 2005, SharePoint, Java, ',' developing the new website for ACT using SharePoint and SQL Server 2005', ' Singing, Listening to Music, Dancing, Cooking, Swimming', BulkColumn from Openrowset( Bulk 'C:\photos\rose.bmp', Single_Blob) as Picture";
SqlCommand myCommand = new SqlCommand(insertSql, enter_conn);
int i = myCommand.ExecuteNonQuery();
I have no data in the table and am doing the first insert. Though the data gets inserted I am getting this exception:
System.Data.SqlClient.SqlException: Violation of PRIMARY KEY constraint 'PK_Details'. Cannot insert duplicate key in object 'dbo.Details'. The statement has been terminated. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at _Default.Enter_Click(Object sender, EventArgs e) in c:Documents and SettingskrkondaXMy DocumentsVisual Studio 2005WebSitesMember ProfilesDefault.aspx.cs:line 82
Can someone please suggest anything???? I appreciate a quick response please!!!!
Thanks,
Kavya
View 1 Replies
View Related
Dec 19, 2006
I am getting this error message
System.Data.SqlClient.SqlException: Invalid object name 'RacingHeritage'
I have noticed from other posts where the database owner is the login name
I rebuilt the table and the owner is now dbo
Here is the Code
Function GetCustomers() As System.Data.DataSet Dim connectionString As String = Application("HiddenConnection") Dim dbConnection As System.Data.IDbConnection = New System.Data.SqlClient.SqlConnection(connectionString)
Dim queryString As String = "SELECT [RacingHeritage].[RHID], [RacingHeritage].[UserID], [RacingHeritage].[Clie"& _ "ntFirstName] FROM [RacingHeritage]" Dim dbCommand As System.Data.IDbCommand = New System.Data.SqlClient.SqlCommand dbCommand.CommandText = queryString dbCommand.Connection = dbConnection
Dim dataAdapter As System.Data.IDbDataAdapter = New System.Data.SqlClient.SqlDataAdapter dataAdapter.SelectCommand = dbCommand Dim dataSet As System.Data.DataSet = New System.Data.DataSet dataAdapter.Fill(dataSet)
Return dataSet End Function
Any Ideas
View 3 Replies
View Related
Jan 19, 2007
Hi,
I am using VS2005 and Sql Server 2000 (personal edition). I am able to connect with SqlClient Provider on Local Machine (when db server and VS2005 on same machine). But I try to connect SqlServer on different machine it is not allowing me to connect. If I use SqlOledb Provider it got connected.
Please tell me how could I connect with DB server (Sql Server 2000) from remote machine.
View 4 Replies
View Related
May 15, 2007
Hello,
we have asp.net apps on a windows 2003 server that connect to an instance of sql server 2005 enterprise edition on another windows 2003 server. We get this error at random times. Anyone know what could be causing it?
System.Web.HttpUnhandledException: Exception of type System.Web.HttpUnhandledException was thrown. ---> System.Data.SqlClient.SqlException: SSL Security error. at System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction) at System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) at System.Data.SqlClient.SqlConnection.Open()Thanks
View 1 Replies
View Related
Jul 26, 2007
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NWHCConnectionString %>" SelectCommand="SELECT * FROM [AI_news]" OnSelecting="SqlDataSource1_Selecting"> </asp:SqlDataSource> This is my code, I have followed the wizard perfectly the way its supposed ot be, well not 100% perfectly. This is how its supposed to be. When using a XXXX.MDF file I could use the wizard and it works fine. I do not know why my above code won't work. I am connected to the database and can view code manually. but not on a aspx page. i am using master page, now trying to add this into default.aspx Any help will be appreciated. I am currently losing some hair.
View 4 Replies
View Related
Mar 8, 2008
I keep getting this error whenever I try to run my query: System.Data.SqlClient.SqlException: Incorrect syntax near '>'.
I'm just trying to fill a dataset with three tables that contain the past few days headlines...what am I doing wrong?? Private Sub fishHeadlines()
Dim dateNow As DateTime = DateTime.Now()Dim dateThen As DateTime = DateTime.Today.AddDays(-2)
'create the table array so we can create the sql statement in a moment
Dim table() As Stringtable = New String() {"Snapper", "Scissor", "MahiMahi"}
Dim strSelect As String
'Create a dataset to hold the tables containing the headlinesDim headlinesDS As New DataSet()
'create the connection string - SnapshotConnectionString is in web.config file
Dim strConnect As StringstrConnect = ConfigurationManager.ConnectionStrings("fishConnectionString").ConnectionString
'create a connection object to the databaseDim objConnect As New SqlConnection(strConnect)
objConnect.Open()
Dim i As Integer
'fill the datatablesFor i = 0 To table.Length
strSelect = "SELECT Event FROM " & table(i) & "WHERE (DateOfEntry > '" & dateThen & "')"
'create a data adapter object using connection and sql statementsDim objDA1 As New SqlDataAdapter(strSelect, objConnect)
'fill the dataset
objDA1.Fill(headlinesDS, table(i))
Next
Dim strTable As StringDim dr As DataRow
strTable = "<table>"For i = 0 To table.Length
For Each dr In headlinesDS.Tables(table(i)).Rows
strTable += "<tr><td>" & dr(0).ToString() & "</td></tr>"
Next
Next
strTable += "</table>"
'display the data
lblHeadlines.Text = strTable
End Sub
View 2 Replies
View Related
Mar 18, 2008
While learning ASP.net 2.0, I was taught that the the default provider for the SqlDataSource was System.Data.SqlClient, and that I only needed to specify it as a provider when I put it in the web.config file. However, now (in VWDE 2008) when I add a SqlDataSource to a page, it adds ProviderName="System.Data.SqlClient". Does this mean that it isnt the default anymore?
View 1 Replies
View Related
Apr 6, 2008
Hello,
I see the following in connection strings all the time: providerName="System.Data.SqlClient"/>
For example:<connectionStrings><add name="classifiedsConnection" connectionString="Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|classifiedsdb.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/></connectionStrings>
What is providerName="System.Data.SqlClient" ? What is it used for?Thanks, Jim
View 3 Replies
View Related
May 1, 2008
Hi there, i copied some insert code from one page to another and it keeps throwing me this error, i was wondering if anyone can help me out. Here is the error
System.Data.SqlClient.SqlException: The name "Credit" is not permitted in this context. Valid expressions are constants, constant expressions, and (in some contexts) variables. Column names are not permitted. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at Admin_expenses.Button1_Click(Object sender, EventArgs e) in d:hostingmemberashdfhtdocswwwAdminexpenses.aspx.cs:line 40
This is my code, i cant see anything obvious and as i said i just copied it across, the only things changed were the names and the sqlstringprotected void Button1_Click(object sender, EventArgs e)
{decimal intamount = Convert.ToDecimal(txtAmount.Text);
string sConnectionStringExpense = "Data Source=xxxx;Initial Catalog=xxxx;User ID=xxxx;Password=xxxx";SqlConnection objConnExpense = new SqlConnection(sConnectionStringExpense);
using (objConnExpense)
{
objConnExpense.Open();string sqlExpense = "INSERT INTO tbl_expenses (expense_amount, expense_payment_type, expense_type, expense_description) " +
"VALUES (" + intamount + "," + ddlPaymentType.SelectedItem + "," + ddlExpenseType.SelectedValue + "," + txtDescription.Text + ")";SqlCommand objCmdExpense = new SqlCommand(sqlExpense, objConnExpense);
try
{
objCmdExpense.ExecuteNonQuery();
}catch (Exception ex)
{lblcomplete.Text = "!!Adjust stock for product at location " + Convert.ToString(ex);
}
finally
{
objConnExpense.Close();
}
}
View 6 Replies
View Related
May 31, 2008
Yesterday, in response to an error msg (something like Login failed for user ''), I deleted the 'providerName=System.Data.SqlClient'in my connectionStrings from Web.config. Then the aspx website worked.I understand that the value "System.Data.SqlClient" specifies that ASP.NET should
use the ADO.NET provider System.Data.SqlClient
when making a connection. Why deleting providerName solved the error? Jeffrey
View 2 Replies
View Related
Mar 9, 2004
Hi everybody,
We are developing Asp.Net Application in following environment.
Windows 2003
Dot Net 2003
SQL Server 2000
Problem :
We have team of four people. We made one machine as database server and rest of the people trying to connect to that database server. we are getting error "SQL server not found.".
We are using following string as a connection string.
"DATA SOURCE=192.292.7.105;DATABASE=xxx;User ID=xxx;password=xxxx"
We have tried same connection string with the VB.Net program. It is working fine.
But when we are trying same string in the web application. It is giving me the above mentioned error.
Can any one help me ?
Thanks is advance.
From
Jigar Shah
View 4 Replies
View Related
Aug 9, 2005
Somebody should please render me some VB.NET codes for implementing an add button click event to add record to my SQL Table from my web form in asp.net application running on my local machine. I am not here with my connection string codes from which the error exists.
View 1 Replies
View Related