I have a table with just a column and a row in a table that it save just a file with size 1.5 GB ! C# application and sql server are in different machines. I want to read that file by DataReader every 100 MB then save all 100 MB files to disk by "FileMode.Append" for file stream and collect them to one file.
i want to inser the value in data base ...i am using asp.net in visual studio 2008...i want syntax to insert the datetime,integer ,float,string data type into the data base.
i want to insert the value in sql data base.in table id coloum is unique.because of this i cant able to select not null type....so i cant able to insert the value in data base.
I'm currently exporting a database table with huge data (100000+ records) into an xml file using XmlTextWriter class and I'm writing directly to a file on the physical drive.
_XmlTextWriterObject = new XmlTextWriter(_xmlFilePath, null);
While my code runs ok, my question is that is it the best approach? Or should I write the whole xml in memory stream first and then write the xml document in physical file from memory stream? And what are the effects on memory/ performance in both cases?
EDIT
I will indeed be using XmlTextWriter but I meant to say whether to pass a physical file path string to the XmlTextWriter constructor (or, as John suggested, to the XmlTextWriter.Create() method) or use stream based api. My current code looks like the following:
I want access remote server data base for my asp.net application my connectin string is
<add name ="Constr" connectionString="Server=xxx.xxx.xx.xxx,xxxSQLEXPRESS;Database=ABC;Integrated Security=True"/> and Error is
Login failed for user ''. The user is not associated with a trusted SQL Server connection. there is not any user id and password for access data base i already tried Uid=sa;password=sa
how can I create a query in order to select some records every time user wanna to display them into a gridview. I don't want to select all entire records from my data source. What I exactly want is to simulate pagination by query.
I don't know how to read data into variables from a SELECT query. I can add, update, and delete queries with no issues. I have browsed a few books, but everyone uses a different approach. Suppose I want to to run a query and 1 record is returned. How do I get the values into my variables.
Suppose my table name is "Job Orders", and the row returned has these 3 fields:
I have a form with several controls. I'm trying to read from database and navigating through single record per page. I'm displaying a single record but not navigating through. My customerID field is the primarykey. But there are gaps btw records (1,2,5,6,10...etc). Some of them were deleted.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Dim myReader As SqlDataReader Dim myConnection = New SqlConnection("server=myPCSQLEXPRESS; database=CustomersDB; uid=myPC est; Password=; Trusted_Connection=yes") myConnection.Open() Dim myCommand = New SqlCommand("SELECT * FROM Customers", myConnection) Dim intFirstRecord As Integer = CInt(myCommand.ExecuteScalar()) myReader = myCommand.ExecuteReader() If myReader.Read Then lblCustomerID.Text = myReader("customerID") lblCustomerName.Text = myReader("CustomerName") End If myReader.Close() myConnection.Close() currentRecord = lblCustomerID.Text End Sub
Sub Next_OnClick(ByVal sender As Object, ByVal e As System.EventArgs) Dim myCommand As SqlCommand Dim myConnection As SqlConnection Dim myReader As SqlDataReader myConnection = New SqlConnection("server=myPCSQLEXPRESS; database=CustomersDB; uid=myPC est; Password=; Trusted_Connection=yes") myConnection.Open() myCommand = New SqlCommand("SELECT TOP 1 customerID, CustomerName FROM Customers WHERE customerID > @customerID", myConnection) myCommand.Parameters.Add("@customerID", SqlDbType.Int, 5).Value = currentRecord myReader = myCommand.ExecuteReader()
If myReader.Read Then lblCustomerID.Text = myReader("customerID") lblCustomerName.Text = myReader("CustomerName") End If myReader.Close() myConnection.Close() End Sub
I'm being able to read first record. If I click Next button, my page goes to next record for only once. If i click several times, nothing happens. Does not go to next available records.
I can directly use to read and display Excel or CSV files using asp web control(GridView, sqldatasource etc). I do NOT want to upload the file first to an sql database before reading them, I just want to read the files directly. I am using asp.net 2.0 and c#.
I know this is probably a pretty easy thing to do and it is if I can upload the file and store it onto the hard drive of the server. What I need to do is read the text file into memory and then parse through it one line at a time. Anyone have any code that demonstrates that?
I am having some issues with my base class inheritance. I am currently employing Table per Type Inheritance for the following tables:
Database:
Members Table
- Member ID (PK)
- First Name
- Last Name
- Email
- ...
Students Table
- Member ID (FK)
- Credits
- Notes
- ...
Instructors Table
- Member ID (FK)
- Biography
- Office Hours
- ...
My Entity Data Model defines "Member" as the base class for both Students and Instructors, since members can be both students as well as instructors simultaneously. The problem, however, occurs when I attempt to get a list of Members objects. Because the database contains members who are indeed students AND instructors, the following exception is thrown:
All objects in the EntitySet 'CountyCollegeEntities.BaseMembers' must have unique primary keys. However, an instance of type 'CountyCollege.NET.Administrator' and an instance of type 'CountyCollege.NET.Student' both have the same primary key value, 'EntitySet=BaseMembers;ID=10016'.
I am beginning to think that I made a mistake by building these classes to inherit from Member although it has been ideal up until this point. But before I start ripping up all my existing code to remove this inheritance, I thought I would see if anyone has any tricks that would make this work. Any advice as to either how I can get around this error or a more appropriate way to structure my classes would be very much appreciated.
We have a .aspx file which has about 400 lines of javascript code. Is it a good idea to have such huge code in its own file? What is the performance difference in having huge javascript code in aspx as against the .js file?
I am Using OboutGrid to Display the data in my Webforms..this is cool when am binding small data..but when am binding huge data it takes more time to display the records rather than normal datagrid. How can i improve the performance..
I am working with GridView, When huge amount of Data is inserted in the GridView its columns became very thin all tall, however I want to Display the Gridview with Fix size and if the Data is hugeit only display the starting few words of Data.in other words I want to use gridView same like the GMAIL account where Data Display like this. .
how can i retrieve the all foreign keys against a single primary key. i mean to say that if a table contain a primary key then it becomes as foreign keys in which tables.
i want to take that nam of that tables and on the base of that tables then i am to delete from all the entries. e.g: if a primary key's column entry deleted then all foreing key entries should also be deleted.
there are 988 tables in a single database. it can't be possible to go for each table to setup foreign key to ON DELETE CASCADE.
.can it have any way to delete against foreign key priority wise? mean to say that parent table contain primary key, child table contain foreign key , now there is another child table which dependent previous child table. then how can i delete all record against it?
i want to do it from programatically. i am using sql server 2005
i have completed this till to that , it retrieves all foreign keys but how to delete now on the base of priority.