|
Dim oSQLConn As SqlConnection = New SqlConnection()
oSQLConn.ConnectionString = "Data Source=(local);" & _
"Initial Catalog=mySQLServerDBName;" & _
"Integrated Security=SSPI"
oSQLConn.Open()
Nav.
|
|
|
|
|
Hi,
In ASP.NET im creating the word document. While document is creating some temp file is creating. So at that time i can't able to down load the file from server machine to client machine.
Eg.
Word File Name : "Endoscopy_2_49_5.doc"
Temp File Name : "~$doscopy_2_49_5.doc"
Error Occurs:
------------------
The process cannot access the file "<path>" because it is being used by another process.
Here im creating the Word Document in the Server Machine. After that from Client Machine im down load the file and do some correction and updating to server. How to over come this one.
Thanks in advance,
Senthil V.
|
|
|
|
|
hi Make sure that u close file handle i.e file writter etc . If possible send code snap....
|
|
|
|
|
|
Can anyone help I want to use cookies in asp.net page login,
please can me an example
Thanks
................
|
|
|
|
|
This code checks whether the browserr accepts cookies and either adds a cookie if it is the user' s first visit to the page or updates the cookie if the user has visited the page before.
// (1) Check if browser accepts cookies.
if (Request.Browser.Cookies)
{
// (2) If the cookie does not exist...
if (Request.Cookies["LastVisit"] == null)
{
// (3) Create cookie.
HttpCookie cookLastVisit = new HttpCookie("LastVisit",
DateTime.Now.ToString());
// (4) Set the expiration to tommorrow.
cookLastVisit.Expires = DateTime.Now.AddDays(1);
// (5) Add to cookies collection.
Response.Cookies.Add(cookLastVisit);
// Display message.
Response.Write("This is your first visit.");
}
else
{
// Get the cookie.
HttpCookie cookLastVisit = Request.Cookies["LastVisit1"];
// Display a message showing time of last visit.
Response.Write("You last visited this page: " +
cookLastVisit.Value);
// Update the cookie on the client.
Response.Cookies["LastVisit"].Value =
DateTime.Now.ToString();
Response.Cookies["LastVisit"].Expires =
DateTime.Now.AddDays(1);
}
}
else
{
Response.Write("Your browser does not accept cookies.");
}
Praveen
Praveen
|
|
|
|
|
Praveen_S wrote: // (1) Check if browser accepts cookies.
if (Request.Browser.Cookies)
Actually that doesn't check if the browser accepts cookies, it only checks if the browser is capable of accepting cookies. The browser may still deny the cookie.
The only way to check if a browser really accepts cookies, is to attempt to set a cookie, and in the next page check if the cookie was accepted.
---
b { font-weight: normal; }
|
|
|
|
|
http://www.15seconds.com/issue/021119.htm
|
|
|
|
|
hi!
can any body guide me that how can i populate datagrid row by row that is i dont want ot use datagrid.datasource = dataset, datagrid.databind() ....
instead i want it in the following senario(manually)
populate a dataset
then go through some loop
check each row on each iteration and specify some criteria
if it match then add that row to grid other wise skip it and move to the next row
plz explain it with the help of code
regards
shezi
|
|
|
|
|
What criteria are you checking against? Would you be able to create a dataview from your dataset table and then perform a filter?
This would be a much simpler solution.
|
|
|
|
|
Hi all,
I am working with asp 2.0 framework. I am using repeater control in my webform.
I want to show all CustomerNames displyed in repeater.
My problem is basically how to retriving field(CustomerName) value from repeater.
I hope u help me........
Thanks.
|
|
|
|
|
If your customer name is in a text box, then maybe something like this:
string customerName;<br />
<br />
foreach ListItem anItem in repeater.Items<br />
{<br />
customerName = (TextBox)anItem.FindControl("txtCustomerName").text;<br />
}
|
|
|
|
|
Thanks For your help.
Bye..........
|
|
|
|
|
I have a radio button on my page and a drop down. the drop down contain some list of titles. if your kind of title does not exist then the user will select the radio button and a text box appears for him to enter his title. How do I do this without using Javascript.
Hrlp!!!
Thanks
AC
|
|
|
|
|
You set AutoPostback to true for the radio button, so that it makes a postback, which enables you to show the text box in the server event.
Note though, that the postback is using Javascript. So if you want to make it without Javascript all together, the answer is that it can't be done.
---
b { font-weight: normal; }
-- modified at 3:07 Wednesday 14th June, 2006
|
|
|
|
|
Hi all.
I would like to develop a DAL to work with MySQL and the .net connector for asp.net 2.0
I create a dataset with the correct data in it and return that as a function. The object datasource can see it and will connect it to a gridview. When the page is run the gridview is populated correctly.
The problem comes when i try to edit the grid view. The columns do not display inside VWD 2005, so i cannot edit them at all.
Is it possible to force a schema on the objectdatasource that the IDE can use.
I have seen it done with custom collections, but as I do not understand them yet I wanted to use a dataset.
The code I have so far is
Private Sub dbConn()
If Not conn Is Nothing Then conn.Close()
Dim connStr As String
connStr = "Server=localhost;Database=dls;Uid=blag;Pwd=blahblah;"
conn = New MySqlConnection(connStr)
End Sub
Public Function selectAllMessages() As DataTable
dbConn()
Dim da As MySqlDataAdapter
Dim Data = New DataTable("messages")
da = New MySqlDataAdapter("SELECT * FROM tbl_messages", conn)
conn.Open()
da.Fill(Data)
Return Data
End Function
|
|
|
|
|
hi!
i m working with a recrsive function to implement a tree structure i got the following output
1
2 ---- 1
4 ---- 2
3 ---- 1
5
now i have a problem that i m unable to solve how can i handle the spaces so it will look something like this
1 --- 0
2 ---- 1
4 ---- 2
3 ---- 1
5 --- 0
second i want to put all this in a datagrid. the method i adobted is that i filled the datagrid with all the parent nodes (in example 1 and 5) and then thinking to add the recursive function returned values under the appropriate parent row (but dont know how to add that result in a datagrid) can any body guide me in this regard that weather its the right way to do it if so then how can i accomplish this (how to make the result a row and then add that to under there parent row in datagrid)
or
if there is some better way then guide me please
regards
shezi
-- modified at 2:48 Wednesday 14th June, 2006
|
|
|
|
|
I am using ASP1.1. I have built a custom error page to post error details, whenever an error occurs in the application. The syntax is as below
session("error") = Ex.message()
response.redirect ("errorpage.aspx")
in "ErrorPage.aspx" i have written the following code on page_load:
lbl_error = session("error")
Problem:
1. I have set an Invalid connection string property in my web.config
2. While the application is running it goes to the Global.asax page and triggers the Application_Error Event
3. There i have written the following code
Dim Message As String = "An unhandled exception thrown. This can also be due to session expiry. Please see the below information. " & _
"MESSAGE: " & Server.GetLastError().Message & _
"STACK TRACE:" & Server.GetLastError().GetBaseException.ToString & _
"PATH: " & Request.Path
Session("Error") = Message
Response.Redirect("ErrorPage.aspx")
Response.End()
4. It rightly goes to the "ErrorPage.aspx"
5. But the Session("error") has a value of nothing
Could anyone guide me on what to be done...or what could have caused this problem
My Session State mode is "InProc"
M Kumar
Senior Software Developer
Coimbatore
-- modified at 2:27 Wednesday 14th June, 2006
|
|
|
|
|
I'm trying to allow users to upload a file to a predetermined folder using the asp:FileUpload control and the SaveAs() method. When page posts back, I get the error:
"Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
The app is hosted, so I can't alter the folder's write permissions directly. The best I could get from the hosting company was a clarification that my app is restricted to "medium" security level and a suggestion to Google the error.
I'm not really clear on Code Access Security, and from what I've read, it seems I can't gain any additional permissions this way anyway. Does anyone have any suggestions on how to accomplish this? I've been all over the Internet looking for a solution to this, and I'm pulling my hair out....
Thank you!
TJ
|
|
|
|
|
You're trying to save a file to the filesystem of your web provider. The aspnet worker process will require read/write permissions on that folder for it to work... No workarounds for this, unless you save your file into a DB...
|
|
|
|
|
using System.IO;
using excel09;
using System.Reflection ;
using System.Runtime.InteropServices;
I am creating a new excel file of version 9 from template of excel 2003.
An Image is there in the template file.
The excel file is got saved and opened.But image is not getting displayed.
Code is
Page.Controls.Clear();
Response.ContentType = "application/vnd.ms-excel";
Response.Buffer=true;
//To open excel files in lower versions also
//Save the byte[] array to xl template file
string xlFileName = "Template.xlt";
string xlFilePath = Server.MapPath("../Reports/") + xlFileName;
string fileExcel = Server.MapPath("../Reports/" + xlFileName); //template file
//Creating instance for excel 9 version
//To create excel file in lower version
excel09.Application ExcelObj = new excel09.Application();
ExcelObj.Visible = true;
xlFileName = "Report - " + System.DateTime.Now.Ticks.ToString() +".xls";
xlFilePath = Server.MapPath("../Reports/") + xlFileName; //Save as file name
//Adding template to workbook
ExcelObj.Workbooks.Add(fileExcel);
Workbooks workbooks = ExcelObj.Workbooks;
_Workbook workbook = workbooks.get_Item(1);
Sheets sheets = workbook.Worksheets;
_Worksheet worksheet = (_Worksheet) sheets.get_Item(1);
//Saving excel file in 9 version format
workbook.SaveAs(xlFilePath, excel09.XlFileFormat.xlWorkbookNormal,null,null,false,false,excel09.XlSaveAsAccessMode.xlShared,false,false,null,null);
workbook.Close(null,null,null);
ExcelObj.Workbooks.Close();
ExcelObj.Quit();
System.Runtime.InteropServices.Marshal.ReleaseComObject (ExcelObj);
System.Runtime.InteropServices.Marshal.ReleaseComObject (sheets);
System.Runtime.InteropServices.Marshal.ReleaseComObject (workbook);
ExcelObj = null;
workbook = null;
sheets=null;
System.GC.Collect();
//Getting from excel version 9 file
Response.WriteFile(xlFilePath);
Response.Flush();
Response.Buffer=false;
Response.End();
|
|
|
|
|
while saving excel file i am getting this error
workbook.SaveAs(xlFilePath, excel09.XlFileFormat.xlWorkbookNormal,null,null,false,false,excel09.XlSaveAsAccessMode.xlShared,false,false,null,null);
"This command is unavailable because the license to use this application has expired."
|
|
|
|
|
{
background: url("../images/button_save.gif")
repeat-x fixed
center top;
width:63;
height:27;
cursor:hand;
BORDER-RIGHT: #104a7b 0px solid;
BORDER-TOP: #afc4d5 0px solid;
BORDER-LEFT: #afc4d5 0px solid;
BORDER-BOTTOM: #104a7b 0px solid;
}
HI the above style sheet is work for internet Exlorer but it does not work on FireFox any solution ????(Style sheet is apply to ASP.NET Button control.)
Yogesh
|
|
|
|
|
You have forgotten the units on the width and height:
width: 63px;<br />
height: 27px;
Also, the "hand" value is non-standard. Use the standard value "pointer" instead:
cursor: pointer;
---
b { font-weight: normal; }
|
|
|
|
|
not working give some other solution
|
|
|
|