I am trying to read data from a SQL Server 2008 database. Initially, I imported a 2007 Access db into the server. I have no problem reading this data. However, if I add new data, either through code or through SQL commands on the Server, I get an error when I try to subsequently read it. I only get the error on new data, not the imported data. Error:
System.InvalidOperationException: Invalid attempt to read when no data is present.
In my page (ASP.NET/VB.NET) I have a dropdown box which is filled with Customer Names. No Problem there. However, when I choose the customer, the rest of the form is supposed to fill with data retreived from the database. If I choose original data, it works fine. However, as soon as I choose a newly added record. It throws the Exception. I have tried to find a solution online, but most answers point to missing read code. I think my code is right, as it reads some records correctly. Is there something that is wrong with my server, or the way I am writing the records?
There is a dropdown box name CNAME on my page...
OnSelectedIndexChanged runs the following code:
sub displaydata(s as Object,e As EventArgs) locked.checked = "True" edit.enabled = "False" Dim CustomerName As String = CNAME.SelectedItem.Text Dim dread as SqlDataReader Dim cn As New SqlConnection() Dim cd As New SqlCommand() cn.ConnectionString = "Data Source=localhost;Initial Catalog=AnalyticalReports;Integrated Security=True;" cd.Connection = cn cd.CommandText = "select Customers.CID, Customers.CNAME, Customers.CADDRESS1, Customers.CCITY, Customers.CSTATE, Customers.CZIP, Customers.CCONTACT, ISNULL(Contacts.CONNAME,'none') AS CONNAME FROM Customers JOIN Contacts ON Customers.CCONTACT = Contacts.CONID WHERE Customers.CNAME = '"+ CustomerName+"'" cn.Open() dread = cd.ExecuteReader() dread.Read() CID.Text = dread("CID") CNAME2.Text = dread("CNAME") CADDRESS1.Text = dread("CADDRESS1") CCITY.Text = dread("CCITY") CSTATE.Text = dread("CSTATE") CZIP.Text = dread("CZIP") CONNAME.Text = dread("CONNAME") cn.Close() dread.close() End Sub
I am currently working on visual studio 2008 , sql express 2005, i have copied .mdf and .ldf files , after i copied these files and try execute some existing stored procedure but exception is coming like " Failed to update database xxxxxxxxxxxxxxxxx.MDF" because the database is read-only", I dont knw what's wrong with this , i have executed same stored procedure in old .mdf and .ldf database , and its working fine . but in copied .Mdf , not working.
"The OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)" reported an error. The provider did not give any information about the error. Cannot initialize the data source object of OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)"."
I am running SQL 2005 on Windows SBS 2003 server.
Also on solution 3 you running the below sql query
Do i need to run it on the master database or on my database?
USE [master] GO EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0', N'AllowInProcess', 1 GO EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0', N'DynamicParameters', 1 GO
CS1061: 'System.Data.SqlClient.SqlDataAdapter' does not contain a definition for 'Rows' and no extension method 'Rows' accepting a first argument of type 'System.Data.SqlClient.SqlDataAdapter' could be found.
This is a very common error as evidenced but the very large number of problems and suggested solutions on the web. I finally got around it last week but can't remember what was the step that did it. At that time, I was building a web application rather than a web site. Is that the difference? As you can see, it is no longer in the APP_DATA folder and is named membership.mdf rather than aspnetdb.mdf. I ran aspnet_regsql.exe to create it and actually had it working and was updating it successfully. But for other reasons, I had to scrap the application and decided to re-create it from scratch as a web site rather than a web application. I had been using Visual Studio 2008 to build the web application but am now using Visual Web Developer 2008 Express Edition to build the web site. Unfortunately, the Visual Studio application will no longer open so I can't verify that the web application still works. Can anybody help? (Please!!!) BTW, ASPNET and NETWORK SERVICE both have full control over the membership.mdf.
I tried this code by inputting the ftp address as ftp//: and the correct username and password and I get the following error
"Unable to connect to the remote server" on line :
FtpWebResponse Response = (FtpWebResponse)Request.GetResponse();I tired this on my ftp server provided by a hosting service and an anonymous ftp located at 193.166.120.5 ?
Note: I was able to connect to both of these ftp through filezilla, via a webbrowser, and through windows command line.
I am uisng asp.net 3.5 with c# as language. I want to read the database and store the data in either array or arraylist so that it can be called further in a dropdown list.
How can i change my Read Only SQL database to make it as the membership provider database?Should i create new query and insert there a code? what is the code please?
I am using file upload mechanism to upload file for an employee and converting it into byte[] and passing it to varBinary(Max) to store into database.
Now I what I have to do is, if any file is already uploaded for employee, simply read it from table and show file name. I have only one column to store a file and which is of type VarBinary. Is it possible to get all file information from VarBinary field?
I'd like to upload an excel file from a user into a SQL database, then capture certain cells and insert them into a table in the database. I can't upload the file to the server due to restrictions, but I can upload it into a database field. I've seen examples on how to read cells from an uploaded excel file on the server, but how do you read cells from an excel file stored in the database? I'm using visual studio 2005 and SQL server 2008. Can this be done by reading from a stream?
I have set up my website to use ASP.NET Membership. it all works fine when trying to use it on my development machine but when I put it on the web server and try to log in, I get this error :
"Failed to update database "C:INETPUBWWWROOTAPP_DATAASPNETDB.MDF" because the database is read-only. "
I have 3 drop down list. 1 is for hours; 1 is for minute; 1 is for AM or PM. I want to read the time in from the database and set the drop down list for the users so they can make updates if need be. I tried ddhour.selectedindex = 1. Can I do this in asp??
Using: Visual web developer 2008; APS.net; VB.net Code; Access db
in my system folder(E:\santhu) i have flat files(.txt and .doc ) .my problem is how to read those files automatically one by one and store the data(records) in to database?
I just purchased a premium Windows hosting account from 1&1. I wish to host my site on there. I have been working on it for quite some time.
The most important part of my website is Authentication, and I cannot get my database to work.
I need to get my site to be able to connect to E:BlahBlahBlahApp_DataASPNETDB.mdf. It is SQL Server 2005. And yes, my hosting package supports it. I have a database set up. Would I need to configure my database to read the .mdf? Or is there a special connection string for files.
way to read xml from a database and then dynamically render out the node name in text and the node value in a checkbox/textboxI want to be able to edit the values and then save it back to the database.I know that you can use serialize the xml to a class object but that only works when you know how the xml looks like.. if im not mistaken?
i am newbie to asp.net.i am trying to make sign up kind of webform where user can submit his image. i have used fileupload control to take image from user.i want to insert that image into a database.how can i achieve this functionality?