Currently, I have a WinCE application which uses the System.Data from NetCF and System.Data.SqlserverCE from MSSQL Server 2005 Mobile Edition. Now, I'm trying to use the System.Data.Sqlclient but I can't seem to find it in my System.Data. I notice that there are different version which is one from NetCF and one from the MS.Net framework itself.
Here's my question: Is it possible for me to use both System.Data? or should I only choose one. This is for my attempt to connect also from an SQLServer and connect to the local SQLServerCE as well.
I have created a windows library control that accesses a local sql database
I tried the following strings for connecting
Dim connectionString As String = "Data Source=localhostSQLEXPRESS;Initial Catalog=TimeSheet;Trusted_Connection = true"
Dim connectionString As String = "Data Source=localhostSQLEXPRESS;Initial Catalog=TimeSheet;Integrated Security=SSPI"
I am not running the webpage in a virtual directory but in
C:Inetpubwwwrootusercontrol
and I have a simple index.html that tries to read from an sql db but throws
the error
System.Security.SecurityException: Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) at System.Security.PermissionSet.Demand() at System.Data.Common.DbConnectionOptions.DemandPermission() at System.Data.SqlClient.SqlConnection.PermissionDemand() at System.Data.SqlClient.SqlConnectionFactory.PermissionDemand(DbConnection outerConnection) at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection,
etc etc
The action that failed was: Demand The type of the first permission that failed was: System.Data.SqlClient.SqlClientPermission The Zone of the assembly that failed was: Trusted
I looked into the .net config utility but it says unrestricted and I tried adding it to the trusted internet zones in ie options security
I think that a windows form connecting to a sql database running in a webpage should be simple
conn.Open(); . Everything works fine when I run it from my computer. When I try to run it from a network share I get the following error,
Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
I am using Visual Studio 2005 and .Net framwork v2.0.50727.
I have a report that uses some embedded custom code. The embedded custom code is a function that execute some sql query on a sql server database.Everything works fine in Visual studio. The report gets deployed on the server successfully, however when running the report from report manager i get the following error message :
The Hidden expression for the table €˜table1€™ contains an error: Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
Public function get_field() as string Dim myConnection As System.Data.SqlClient.SqlConnection Dim myCommand As System.Data.SqlClient.SqlCommand Dim data_reader As System.Data.SqlClient.SqlDataReader Dim field(100) as string Dim i as integer Dim j as integer Dim sql_field as string Dim nbr_field as integer Dim rtn_string as string
i = 0 sql_field ="Select field from mytable" myConnection = New System.Data.SqlClient.SqlConnection("Datasource=xxx.xxx.xxx.xxmydatabase;Initial Catalog=mydatabase;User Id=user1;Password=password1;") myConnection.Open() myCommand = New System.Data.SqlClient.SqlCommand(sql_field, myConnection) data_reader = myCommand.ExecuteReader() While data_reader.Read() if data_reader.HasRows then field(i)= data_reader(0).ToString() end if nbr_field = nbr_field + 1 i= i+1 End While data_reader.Close() myConnection.Close()
for j = 0 to nbr_field -1 rtn_string = rtn_string + field(j) + "," Next j
rtn_string = left(rtn_string,rtn_string.length-1) return rtn_string 'return sql_cmd 'return yes_no 'return lkupfield end function
Hi, I've written this code multiple times now. But for the first time i get an error at the line underlined. My procedure runs perfectly when i execute it through Sql Query analyzer. plzz help.. Its urgent and am unable to find the reason for this error "A first chance exception of type 'System.Data.SqlClient.SqlException' occurred in system.data.dll" Thanks !SqlConnection conn = new SqlConnection(DbConnectionString); conn.Open(); SqlCommand cmd = conn.CreateCommand(); cmd.CommandText = "dbo.rqryTradesPRR"; cmd.Parameters.Add("@COBDate",SqlDbType.DateTime).Value = "2002-10-31 00:00:00.000" ; SqlDataReader reader = cmd.ExecuteReader(); while(reader.Read()) { // have written something here
I am trying to make a mobile application work, but I get the following error. The operating system on Pocket PC is Microsoft® Windows Mobile„¢ 2003 Second Edition. Any ideas? Thanks in advance.
The followings are the error and my codes:
System.TypeLoadException was unhandled Message="Could not load type 'System.Data.SqlServerCe.SqlCeDataAdapter' from assembly 'System.Data.SqlServerCe, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91'." StackTrace: at SQLMobile.Form1.Form1_Load() at System.Windows.Forms.Form.OnLoad() at System.Windows.Forms.Form._SetVisibleNotify() at System.Windows.Forms.Control.set_Visible() at System.Windows.Forms.Application.Run() at SQLMobile.Form1.Main()
Codes:
Private Sub FillGrid()
Dim filename As New String _
("Program FilesSQLMobilesqlmobile.sdf")
Dim conn As New SqlCeConnection("Data Source=" + filename)
Dim selectCmd As SqlCeCommand = conn.CreateCommand()
selectCmd.CommandText = "select Destination from flightdata"
I am trying to put the data from a field in my database into a row in a table using the SQLDataSource.Select statement. I am using the following code: FileBase.SelectCommand = "SELECT Username FROM Files WHERE Filename = '" & myFileInfo.FullName & "'" myDataRow("Username") = CType(FileBase.Select(New DataSourceSelectArguments()), String)But when I run the code, I get the following error:Server Error in '/YorZap' Application. Unable to cast object of type 'System.Data.DataView' to type 'System.String'. 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.InvalidCastException: Unable to cast object of type 'System.Data.DataView' to type 'System.String'.Source Error: Line 54: FileBase.SelectCommand = "SELECT Username FROM Files WHERE Filename = '" & myFileInfo.FullName & "'" Line 55: 'myDataRow("Username") = CType(FileBase.Select(New DataSourceSelectArguments).GetEnumerator.Current, String) Line 56: myDataRow("Username") = CType(FileBase.Select(New DataSourceSelectArguments()), String) Line 57: Line 58: filesTable.Rows.Add(myDataRow)Source File: D:YorZapdir_list_sort.aspx Line: 56 Stack Trace: [InvalidCastException: Unable to cast object of type 'System.Data.DataView' to type 'System.String'.] ASP.dir_list_sort_aspx.BindFileDataToGrid(String strSortField) in D:YorZapdir_list_sort.aspx:56 ASP.dir_list_sort_aspx.Page_Load(Object sender, EventArgs e) in D:YorZapdir_list_sort.aspx:7 System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +13 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +45 System.Web.UI.Control.OnLoad(EventArgs e) +80 System.Web.UI.Control.LoadRecursive() +49 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3743 Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210 Please help me!
I am stuck with a SSIS package and I can€™t work out. Let me know what steps are the correct in order to solve this. At first I have just a Flat File Source and then Script Component, nothing else.
Error:
[Script Component [516]] Error: System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to class type 'System.Data.SqlClient.SqlConnection'. Instances of types that represent COM components cannot be cast to types that do not represent COM components; however they can be cast to interfaces as long as the underlying COM component supports QueryInterface calls for the IID of the interface. at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.HandleUserException(Exception e) at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.AcquireConnections(Object transaction) at Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostAcquireConnections(IDTSManagedComponentWrapper90 wrapper, Object transaction)
Script Code (from Script Component):
' Microsoft SQL Server Integration Services user script component ' This is your new script component in Microsoft Visual Basic .NET ' ScriptMain is the entrypoint class for script components
Imports System Imports System.Data.SqlClient Imports System.Math Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper Imports Microsoft.SqlServer.Dts.Runtime.Wrapper
Public Class ScriptMain Inherits UserComponent
Dim nDTS As IDTSConnectionManager90 Dim sqlConnecta As SqlConnection Dim sqlComm As SqlCommand Dim sqlParam As SqlParameter
Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)
Dim valorColumna As String Dim valorColumna10 As Double
valorColumna = Row.Column9.Substring(1, 1)
If valorColumna = "N" Then valorColumna10 = -1 * CDbl(Row.Column10 / 100) Else valorColumna10 = CDbl(Row.Column10 / 100) End If
Executed SQL statement: SELECT Schoolindex, Variant, VVSchool, [index], indincl, VVRuimtes, School FROM School WHERE (Schoolindex = @PARAM1)
Error Source: SQL Server Compact Edition ADO.NET Data Provider
Error Message: @PARAM1 : Unable to cast object of type 'System.Data.SqlTypes.SqlInt32 to type System.IConvertable'. ****************************************
The same querypreview works fine without the parameter:
SELECT Schoolindex, Variant, VVSchool, [index], indincl, VVRuimtes, School FROM School WHERE (Schoolindex = 186)
Can anybody tell me why this is? And tell me a way to get the tableadapter working?
I am using a stored procedure which returns a value of charecter datatype 'V' to the calling program.I am getting an sql exception System.Data.SqlClient.SqlException: Syntax error converting the varchar value 'V' to a column of data type inti didnot define any int datatype in my tablethis is my codeSqlCommand com = new SqlCommand("StoredProcedure4", connection);com.CommandType = CommandType.StoredProcedure; SqlParameter p1 = com.Parameters.Add("@uname", SqlDbType.NVarChar);SqlParameter p2 = com.Parameters.Add("@opwd", SqlDbType.NVarChar);SqlParameter p3 = com.Parameters.Add("@role", SqlDbType.NVarChar);p3.Direction = ParameterDirection.ReturnValue;p1.Value = username.Text.Trim();p2.Value = password.Text.Trim();com.ExecuteReader();lblerror2.Text = (string)(com.Parameters["@role"].Value); can your figure out what is the error ? Is it a coding error or error of the databse
Aaarrgghhhhhhh, still searchin' for a nice step-by-step article to learn data access (all insert delete update commands) with the SQL Server .NET Data Provider found in [System.Data.SqlClient] namespace....
Hey All, I am developing a data acquistion system which monitors the amount of energy that a user consumes in different parts of a house and displays the information in real time on their computer screen. I am collecting the data through tranducers attached to the circuit breakers in the breaker box and sending the data to analog-to-digital converter channels in a MCU. I am retrieving the data from the serial port and storing it to a text file. Each line of data in the text file represents three fields which are separated by commas. I will be reading data from multiple data collection boxes so the first field is the unit number, the second fied represents the analog-to-digital converter channel number from each unit, and the third field is the data that is collected from the ATD channel. I am trying to use SSE to retrieve the data from the text file, and parse each line of data into individual columns in a databse. Then I want to be able to extract the data associated with a particular ATD channel number from the databse and display it in the appropriate text field on a windows form. I've got the MCU programmed. I have no problem collecting the data from the serial port, and I can do the visual basic programming okay. I have absolutely no clue how to read the data into the database, continuosly read new values into the databse, and then access the stored data to update the text fields on the form. Please help if you can, I've been working on this specific problem for a couple of weeks and I'm not making any progress. Thanks.
i someone had teach me how to write a query in datatable. however i need to get the data out from my database rather than the data table. can someone teach me how should i do it?esp at the first like.... like DataTable dt = GetFilledTable() since i already have set of data in my preset table i should be getting data from SqlDataSource1 right ( however i am writing this in my background code or within <script></script> so can anyone help me? protected void lnkRadius_Click(object sender, EventArgs e) { DataTable dt = GetFilledTable(); double radius = Convert.ToDouble(txtRadius.Text); decimal checkX = (decimal)dt.Rows[0]["Latitude"]; decimal checkY = (decimal)dt.Rows[0]["Longitude"]; // expect dt[0] to pass - as this is our check point // We use for rather than fopreach because the later does not allow DELETE during loop execution for(int index=0; index < dt.Rows.Count; index++) { DataRow dr = dt.Rows[index]; decimal testX = (decimal)dr["Latitude"]; decimal testY = (decimal)dr["Longitude"]; double testXzeroed = Convert.ToDouble(testX -= checkX); double testYzeroed = Convert.ToDouble(testY -= checkY); double distance = Math.Sqrt((testXzeroed * testXzeroed) + (testYzeroed * testYzeroed)); // mark for delete (not allowed in a foreach - so we use "for") if (distance > radius) dr.Delete(); } // accept deletes dt.AcceptChanges(); GridView1.DataSource = dt.DefaultView; GridView1.DataBind(); }
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
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
I've been given the task of moving data from an old system to a new one. That's easy enough apart from some of the data fields do not match in the least:
Example: In the old system (tableOld) there is a field that contains text data such as 'Laboratory','Field','Market','Demo','Development', but this one field could contain one or more of these. In the new system (tableNew) there are boolean fields for each of the above.
What I need is a way to check for these and then make sure the correct field(s) gets ticked (1 entered into the field) in the new system.
Any suggestions, just trying to get my head around SSIS.
Sorry being a little vague but if you can point me in the right direction. I have just created a new VB €“ Windows Mobile 5.0 pocket PC €“ Device Application. (which will be connected to a PDA)
Do i have to use System.Data.SqlServerCe or System.Data.SqlClient to connect to my db.
my environment: VS2005, SQLExpress with SP1, WXP with SPs, the error msg I get is: 'System.Data.DataRowView' does not contain a property with the name 'change'. The base for all this is the 'MS Club Site' sample code downloaded from ASP.NET! After adding a new data field "change" to my DB I changed the StoredProcedure "PagedUpcommingEventList" (statement 31) and in the 'Repeater' I added statement 32 to reflect this change (see code below). When calling 'Configure Data Source' on the SQLDataSource I can read the DB (using the StoredProcedure) but I never see the new field 'change'! I certainly checked for additional StoredProcedures with the same name: "PagedUpcommingEventList" --- I definitely have only one in my project.PS: In another .aspx file using a SQLDataSource with a DataGrid; the field is showing up correctly! I spent days in the area of 'caching' without any success; thought the StoredProcedure is always called from the 'cache'! .... Thank you for your time .... any idea is appreciated! ed 1 <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ClubSiteDB %>" 2 SelectCommand="PagedUpcommingEventList" SelectCommandType="StoredProcedure" OnSelected="SqlDataSource1_Selected" CacheDuration="1"> 3 <SelectParameters> 4 <asp:Parameter Name="pageCount" Direction="ReturnValue" Type="Int32" /> 5 <asp:ControlParameter Name="pageNum" ControlID="pn1" PropertyName="SelectedPage" /> 6 <asp:Parameter DefaultValue="5" Name="pageSize" Type="Int32" /> 7 </SelectParameters> 8 </asp:SqlDataSource> 1 <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1"> 2 <ItemTemplate> 3 <div class="listitem"> 4 <%-- class="thumbnail"> 5 <a href='<%# "Events_view.aspx?Eventid=" &Cstr( Eval("ID"))%>'> 6 <Club:ImageThumbnail ID="ImageThumbnail1" runat="server" PhotoID='<%# Eval("photo") %>' 7 NoPhotoImg="images/calendar.jpg" /> 8 </a> 9 </div>--%> 10 <asp:panel ID=panel2 runat=server cssclass="editbuttons" Visible='<%#Isadmin %>'> 11 <Club:RolloverLink ID="EditBtn" runat="server" Text="Edit" NavigateURL='<%# "Events_Edit.aspx?Action=Edit&id=" & cstr(Eval("id")) %>' /> 12 <Club:RolloverLink ID="RemoveBtn" runat="server" Text="Remove" NavigateURL='<%# "Events_Edit.aspx?Action=Remove&id=" & cstr(Eval("id")) %>' /> 13 </asp:panel> 14 <%--> 15 <asp:Label ID="itemdateLabel" runat="server" Text='<%# Eval("starttime","{0:d}") %>' /> 16 <a href='<%# "Events_view.aspx?Eventid=" &Cstr( Eval("ID"))%>'> 17 <asp:Label ID="titleLabel" runat="server" Text='<%# Eval("title") %>' /> 18 </a> 19 </h3> 20 <p> 21 <asp:Label ID="descriptionLabel" runat="server" Text='<%# truncate(CStr(Eval("description"))) %>' /> 22 <a href='<%# "Events_view.aspx?Eventid=" &Cstr( Eval("ID"))%>'>read more »</a></p> 23 <div class="clearlist"> 24 </div>--%> 25 <h3> 26 <asp:Label ID="Label1" runat="server" Text='<%# Eval("starttime","{0:d}") %>' /> 27 <a href='<%# "Events_view.aspx?Eventid=" &Cstr( Eval("ID"))%>'> 28 <asp:Label ID="Label2" runat="server" Text='<%# Eval("title") %>' /> 29 </a> 30 </h3> 31 <asp:Label ID="Label3" runat="server" Text='<%# truncate(CStr(Eval("description"))) %>' /> 32 <asp:Label ID="changeLabel" runat="server" Text='<%# Eval("change") %>' style="position:relative ; LEFT:300px" Font-Names="Arial" Font-Size="Medium"/> 33 <div class="clearlist"></div> 34 <p></p> 35 </div> 36 </ItemTemplate> 37 </asp:Repeater> 1 CREATE PROCEDURE PagedUpcommingEventList 2 ( 3 @pageNum int = 1, 4 @pageSize int = 10 5 ) 6 7 AS 8 declare @rows int 9 declare @keydate datetime 10 declare @keyid int 11 declare @rowCount float /* yes we need a float for the math */ 12 13 if @pageNum = 1 14 begin 15 set @keydate= GETDATE() 16 set @keyid=0 17 end 18 else 19 BEGIN 20 /* get the values for the date and row */ 21 select @rows = (@pageNum-1) * @pageSize 22 SET ROWCOUNT @rows 23 select @keydate=starttime, @keyid=id from Events 24 WHERE Events.starttime > GetDATE() 25 ORDER BY starttime asc, id asc 26 END 27 28 select @rowCount=count(*) from Events WHERE Events.starttime > GetDATE() 29 30 SET ROWCOUNT @pageSize 31 SELECT Events.id, Events.starttime, Events.title, Events.description, Events.photo, Events.change, 32 Locations.title AS locationname 33 FROM Events LEFT OUTER JOIN Locations ON Events.location = Locations.id 34 WHERE (Events.starttime > @keydate OR 35 (Events.starttime = @keydate) AND (events.id > @keyid)) 36 ORDER BY Events.starttime asc, Events.id asc 37 RETURN CEILING(@rowCount/@pageSize) 38 GO
Hi, I got the error A first chance exception of type 'System.Data.OleDb.OleDbException' occurred in System.Data.dll The thread 0x3a24 has exited with code 0 (0x0). 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.OleDb.OleDbException: Unrecognized database format 'C:inetpubwwwrootExcelData.xlsx'.The file exists at that location . i tried this solution. I tried to change permissions but it was not saving it. To resolve this problem, enable read/write permissions for the impersonated user account in the Temp folder. To do this, follow these steps:
1. In Windows Explorer, locate the following folder: Document settingsServerNameASPNETLocal settingsTemp
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
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
[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.
I am new to SS7. We are planning to rearrange our system databases so that the logs are on one drive and the data files are on a different drive. I found a really good white paper on this but just want to verify that there is not a problem with doing this. In sybase there were some restrictions on doing this. Any info you have would be appreciated.
Hi, I am using the DTS tool to Copy tables/date form AS400 files to Sql2005. When I enter the query select * from tableas4000 then I can see all the rows, the statement is parsed in the next step I get the error " An error occured which the SQL Server Integration services wizard was not prepared to handle. No error message available,result code:DB_E_CANTCANCEL(0*80040E15).(System.Data)".
How do I solve this? I am using IBMDB2 UDBFOR ISEREIS IBMDA400 OLE DB PROVIDER.
new to SQL Server 2000. We have an obsolete database that we need tosave off for x number of years. DB2 has utilities (DB2Look/Export)that allows for the export of the data along with a schema and scriptthat enables the future recreation of the structure of the databasesand tables to include RI etc. You can save off the architecture andrelationships of the tables as well as the data.Does SQL Server have anything similar?Thanks in advance.Gerry
I believe I've encountered a compatability problems with Visual Studion CF 2, specifically with the System.Data.SQLServerCE reference when trying to run (in debug mode - Pocket PC 2003 emulation). The environment is configured as follows:
Visual Studio 2005 - Compact Framework 2.0.50727
Microsoft SQL Server 2005 Mobile Edition
The (VB) project includes the following references:
System.Data.dll V2.0.000 from Program FilesMicrosoft Visual Studio 8Smart DevicesSDKCompact Framework2.0V2.0WindowsCE
System.Data.SqlServerCE.dll V3.0.5214.0 from Program FilesMicrosoft SQL Server Mobile EditionDeviceMobileV3.0
The IDE does not sense any problems with the following code until I try to run it in debug mode using the Pocket PC 2003 emulator. The code :
Imports System
Imports System.IO
Imports System.text
Imports System.Data
Imports System.Data.SqlServerCe
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MsgBox("Will Test SQL")
Call testSQL()
End Sub
Private Sub testSQL()
Dim strConn As String = "Data Source = Test.sdf; Password = <password>"
In the debugger, the program terminates at Dim CEEngine As New SqlCeEngine(strConn). The message displayed is
Can't find PInvode DLL 'sqlceme30.dll'
I've tried referencing a different version of System.Data.SqlServerCE.dll (from Program FilesMicrosoft SQL Server90ToolsBinnVSShellCommon7IDE but the program will not even deploy to the emulator with this reference.
I encounter a Deployment/and or registration failed wit error : 0x8973190e - There is not enough space on the disk.
I've inherited a .NET CF 2.0 application at work that uses SQL CE, and as I'm digging into the build process, I'm getting confused about which version of SQL CE that is being used.
The project references System.Data.SqlServerCe (no hint path, just from wherever VS 2005 has it). When I look at the assembly in my project, the version shows up as 3.0.3600.0, but when I browse to the DLL's location on my hard drive (C:Program Files (x86)Microsoft Visual Studio 8SmartDevicesSDK\SQL ServerMobilev3.0System.Data.SqlServerCe.dll), right click the DLL and check the properties, the version shows up as 3.0.3600.0.
In our installation package, we install three SQL CE Cabs: sqlce30.dev.ENU.ppc.wce5.armv4i.CAB sqlce30.ppc.wce5.armv4i.CAB sqlce30.repl.ppc.wce5.armv4i.CAB
When installed on the device, the Remove Programs dialog shows as "Microsoft SQL Mobile 2005..." is installed. We keep the cabs in a seperate location so they are not just pulled from anywhere on the hard drive.
However, when I install the same CAB files located at: C:Program Files (x86)Microsoft Visual Studio 8SmartDevicesSDKSQL ServerMobilev3.0wce500armv4i, the device shows "Microsoft SQL Mobile 2005 Compa...." is installed.
In my Add References dialog, System.Data.SqlServerCe has version 3.0.3600.0, runtime v2.0.50727
Some questions: 1. Is the version 3.0.3600.0 the same between 3.0 and 3.1? 2. Given a System.Data.SqlServerCe DLL, how can I tell if it is the 3.0 or 3.1 version? 3. When upgrading my project to use 3.1, is it enough simply to upgrade my build environment? Or should I need to change the references in my project? (It appears that the 3.1 DLLs have been placed into the default locations where VS 2005 is pulling them from). I'm using VS 2005 SP1 on Vista x64.
Here's a new one I came across that stumped me for a bit. DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'xxxx'. It appears that one of my dropdown menus was referencing the old SqlDataSource1for its data source id. I had already changed the name of the of the id to something else though. To fix it, I just updated the reference to the new name.
How do I get a System Table like 'Sysobjects' into the Data Access Layer? My app generates tables on the fly, and has to check in the sysobjects table which tables are present.
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)
myCODE ; public void FullnameOfOwner() { GATEWAY.DSMESAJTableAdapters.MESAJMERKEZI_GELEN_MESAJLAR_EMLAKCIADITableAdapter adapEmlakciAdi = new GATEWAY.DSMESAJTableAdapters.MESAJMERKEZI_GELEN_MESAJLAR_EMLAKCIADITableAdapter();GATEWAY.DSMESAJ.MESAJMERKEZI_GELEN_MESAJLAR_EMLAKCIADIDataTable dtGelenMesajlar = new GATEWAY.DSMESAJ.MESAJMERKEZI_GELEN_MESAJLAR_EMLAKCIADIDataTable(); adapEmlakciAdi.Fill(dtGelenMesajlar, OwnerID); grdGelen.DataSource = dtGelenMesajlar; grdGelen.DataBind(); } public void MessagesfromOWNER() {GATEWAY.DSMESAJTableAdapters.MESAJMERKEZI_GELEN_MESAJLARTableAdapter adapGelenMesajlar = new GATEWAY.DSMESAJTableAdapters.MESAJMERKEZI_GELEN_MESAJLARTableAdapter();GATEWAY.DSMESAJ.MESAJMERKEZI_GELEN_MESAJLARDataTable dtGelenMesajlar = new GATEWAY.DSMESAJ.MESAJMERKEZI_GELEN_MESAJLARDataTable();adapGelenMesajlar.Fill(dtGelenMesajlar, (int)OwnerID,(int)UserID,"EMLAKÇI"); grdGelen.DataSource = dtGelenMesajlar; grdGelen.DataBind(); } protected void grdGelen_PreRender(object sender, EventArgs e) { MessagesfromOWNER(); FullnameOfOwner(); } MyDatabaseQuery SELECT _NAME, FROMID, TOID, _DESCRIPTION, _CATEGORY, _OWNERID, _LASTMODIFYDATE, _ID, FROMTYPEFROM MESSAGEWHERE (TOID = @TOID) AND (FROMID = @FROMID) AND (FROMTYPE = @EMLAKCI) for Message SELECT FIRSTNAME + ' ' + LASTNAME AS FULLNAME, USERIDFROM [USER]WHERE (USERID = @USERID) for fullname so i have there columns so i write grdGelen columns[0] >_NAME , columns[1] > LASTMODIFYDATE Columns[2] > FULLNAME AND DATAKEYNAMES TOID,FROMID,FROMTYPE is of MY GRİDVİEW i have a problem on dataset. i create two tableadapters and datatables because i must take from different datase fullname so it is showing this mistake "'System.Data.DataRowView' does not contain a property with the name 'TOID'." what can i do ?