|
|
Thanks its great its working ,but how to safe a .doc file like how to safe users word document resume in sqlserver database and retriving it
|
|
|
|
|
The upload function is the same whatever type of document (you can store .doc files in an "Image" datatype - it's just a blob field.
The OnPageLoad function where the file is retrieved:
Assuming the uploaded file is in the table MyTable in a column called MyFile, the mime type of the file is stored in MyFileMIME and the id field is MyID
private void Page_Load(object sender, System.EventArgs e)
{
int MyID = Convert.ToInt32(Request.QueryString["MyID"]);
SqlConnection connection = new
SqlConnection (@"server=INDIA\INDIA;database=iSense;uid=sa;pwd=india");
connection.Open ();
try
{
SqlCommand command = new
SqlCommand("select myFile, myFileMime from MyTable " +
"where MyID = @MyID", connection);
command.Parameters.AddWithValue("@MyID", MyID);
byte[] myFile = null;
string myMimeType = "";
SqlDataReader reader = command.ExecuteReader();
reader.Read();
myFile = reader.GetBytes(0, 0, myFile, 0, int.MaxValue);
myMimeType = reader.GetString(1);
}
finally
{
connection.Close();
}
Response.Clear();
Response.ContentType = myMimeType;
Response.BinaryWrite(myFile);
Response.End();
}
The above function takes retrieves both the file data and the mime type from the database (which you would have stored previously. For a word doc it's something like application/word and for a jpeg it's something like image/jpg but you could google mime types for more info (I'm just doing this from memory).
The above function replaces the html in the page with the file you are retrieving, so to use the above to display an image in a web page, you would use html like this:
in MyHtmlPage.html
<img src="GetFile.aspx?MyID=12345" width="100" height="100">
where file id 12345 is an image
or to retrieve a word doc, you would just put a link to it:
in myHtmlPage.html
<a href="GetFile.aspx?MyID=12345">Download file</a>
where file id 12345 is a file to download.
One final note: the above page load function is not particularly secure (it's for demonstration purposes only). You should google for info about "sql injection attacks" and modify the data access appropriately.
Hope that helps.
|
|
|
|
|
hi
is anybody familiar with production-ready distributed/clustered cache solution for .net ?
Google helped me to found some (like ncache and scale-out-state-server), but they are over-priced
thanks anyway for your time reading that
###
|
|
|
|
|
hi every body
in my code, i bind a data to dataset then make this dataset the datasource to my datagrid.
i want to prevent some columns from appearing in the datagrid but please don`t tell me to filter it in the select query i want to prevent these columns from appearing after the dataset is bound
what can i do?
haitham
|
|
|
|
|
Hide the column in the DataGrid.
Set the columns in the designer and set visible to false for the columns you don't want displayed.
only two letters away from being an asset
|
|
|
|
|
Can you detect the back button and fire an ASP event before you navigate away? Actually, can someone show me how to fire an ASP event and also a JavaScript function call? That would be best. I'll need to do both.
As always, a URL to somewhere else is just fine with me.
|
|
|
|
|
|
hello
thanks for the time
I have just a short time programming
i have the next scene :
for example when the page is load you use a field hidden to load it with data that you usen in then side client
for example a textbox hidden you load text property with country and
depend the user activity in the side client yo have have conditions for the type the country that data's field hidden
it is a simple example because with this technique there are bad scenes
some one could say me what is the correct way to work with data
between server side y client side in asp net
thanks for the time
sorry for me english
|
|
|
|
|
|
thanks ashish
the links are very interesting
|
|
|
|
|
I have four projects and everytime if i do changes in any signature or add any new method etc in any one project then i need to remove all reference and then include them again. ....This is very painful to do this everytime during project coding stage....
Is there any way to get rid of this. I had created macro but i am not so happy with this solution....
Amit
|
|
|
|
|
Add a reference to the project rather than the assembly.
Project A needs to include output from Project B & C so you add a reference to Project A and select the project tab, then add Project B & C, provided these are all in the same solution.
only two letters away from being an asset
|
|
|
|
|
Problem with controls seeking inside DataGrid
Code : http://www.nomorepasting.com/paste.php?pasteID=72799
create controls 200-236
(method Controls.Add are invoked in line 229...
Check in 231,
but can`t find them in line 136, why?!!!!
|
|
|
|
|
International Company Now Hiring Home Workers (9261)
Earn a guaranteed income for completed work
Multiple positions available, for full details visit:
(http://www.typeinternational.com/affil/ti9261.htm)
KAPIL KHANNA
|
|
|
|
|
How can I register as a member?
<< >>
|
|
|
|
|
|
i have 3 combo boxes (first combo box's selection determines the next ones content)
so when user selects first Postback occurs and page refreshes and the content in the second combobox changes.
Now all is working well,
however on a slow connection user selects first combo box and then quickly tries to select the second one but the post back hasn't returned yet... so how can i disable the page/comboboxes once the user makes his selection.
i hope all that made sense i am terribly new at this (and yes i am using asp.net and c#)
If you think you can than you can, if you think you can't you are right.
|
|
|
|
|
Basically, if you want to disable an element at client side, you can use javascript to set the disabled[^] to true. So in this case, if you want to disable the second dropdownlist once the user makes his selection on the first one, you can use the onchange event of the first dropdownlist to run your script to disable the second one. The sample code to register the script looks something like:
DropDownList1.Attributes.Add("onchange", "YourDisableScript(...);");
One more thing that you might should know is that when an input element like dropdownlist or textbox ... is disabled, its value is not submitted to the server when the page posts back. So if you want to disable the first dropdownlist, you will need to persist the value in a hidden element so that you can populate the second dropdownlist. Also, you might also consider using ajax in this case instead of posting the page back to populate the other dropdownlist based on the selection of the first one.
|
|
|
|
|
i want to deploy and test my web app on a Local Area Network, do anyone has the procedure of doing this.
pls respond.
t.aransiola
|
|
|
|
|
Just simply copy all aspx pages and dll files to web server
Then create a virtual directory...
<< >>
|
|
|
|
|
I am using the asp menu control.The menu is horizontal orient. It works fine with the english part when i try to use it with arabic style right to left the dynamic menu starts from the left side as it works in english. I have given the direction as rtl the popout of the dynamic menu comes in the right side. The problem is the dynamic menu which popouts from the static menu is aligning to the left of the static menu. The dynamic menu should be aligned to the right side of the static menu.
|
|
|
|
|
In asp.net, i want to change the image of the image web control at regular time intervals,for that i have used the timer control but the image was displaying
how to do that
|
|
|
|
|
Check out ASP.NET ajax extensions, it's perfect for what you want: http://ajax.asp.net/default.aspx?tabid=47[^]
WM.
What about weapons of mass-construction?
"You can always try to smash it with a wrench to fix that. It might actually work" - WillemM
|
|
|
|
|
Here when i am giving code in aspx.vb ,bydefault,for the button event it is giving functions return type as private.when i am debugging it it is giving error that Private is not accessible in this context.If i decalre it as public it is working.
But why it is not working for private???If i want to continue as private wat changes i have to make.
My friends programs are working with 'private'.
give me a solution
kissy
|
|
|
|