Hi all, pls help me in my application using C#.net (window form) i need to save a .txt file. but if the same filename exist i need to save it as a new filename. i have searched in net but could only find deleting existing or overwritting on the file. pls help to get some solution
sivaram praveen
Posts
-
How to create a new text filename if it exists in window forms using C#net -
exporting to excelhi all, in my application im having code to convert the datagrid values to excel sheet but when it is saving it is taking .html extension instead if .xls, pls help me to sort out. Response.Clear() Response.Buffer = True Response.AddHeader("content-position", "attachment;filename=FileName.xls") Response.Charset = "" Response.Cache.SetCacheability(HttpCacheability.NoCache) Response.ContentType = "application/vnd.ms-Excel" Me.EnableViewState = False Dim stringwrite As New System.IO.StringWriter Dim htmlwrite As System.Web.UI.HtmlTextWriter = New HtmlTextWriter(stringwrite) Dim da_GetAllBooks As SqlDataAdapter = New SqlDataAdapter("GetAllBooks_Proc", Con) da_GetAllBooks.SelectCommand.CommandType = CommandType.StoredProcedure da_GetAllBooks.Fill(_dataSet, "AllBooks(0)") Dim index As Integer = 0 For index = 0 To dg_AllBooks.Columns.Count - 1 dg_AllBooks.Columns(index).SortExpression = True Next dg_AllBooks.DataSource = (_dataSet.Tables("AllBooks")) dg_AllBooks.DataBind() dg_AllBooks.RenderControl(htmlwrite) Response.Write(stringwrite.ToString()) Response.End() help me
-
import xls to sqlserver table -
importing excel sheet into a database table [modified]hi, In my application i need to import the excel sheet data into a database table "Emp_Profile_Tbl" which is created in the database. Dim connstr As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("Team wise EMP Profile (2).xls") + ";Extended Properties=Excel 8.0;" Dim objconn As New OleDbConnection(connstr) Dim ds As New DataSet Dim objadapter As New OleDbDataAdapter("SELECT * FROM [Sheet1$]", objconn) objadapter.TableMappings.Add("Table", "Emp_Profile_Tbl") Try 'in excel: insert->name->seleziono il range:nomi objconn.Open() objadapter.Fill(ds) dg_empprofile.DataSource = ds.Tables(0).DefaultView dg_empprofile.DataBind() Finally objconn.Close() End Try i'm getting the values into datgrid but the values are not saving in "Emp_Profile_Tbl" database table. pls help me to sort this out. Thank u,
modified on Thursday, December 13, 2007 2:37:51 AM
-
importing excel sheet into datagridhi all, In my application vb.net 2003 and ASP.net i have to import excel sheet into sql server 2003 existing table n then into datagrid. I have used this code but throwing an error "System.Data.OleDb.OleDbException: The Microsoft Jet database engine could not find the object. Make sure the object exists and that you spell its name and the path name correctly." Dim connstr As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("Team wise EMP Profile.xls") + ";Extended Properties=Excel 8.0;" Dim objconn As New OleDbConnection(connstr) Dim ds As New DataSet Dim objadapter As New OleDbDataAdapter("SELECT * FROM Emp_Profile_Tbl", objconn) Try objconn.Open() objadapter.Fill(ds, "nomi") dg.DataSource = ds.Tables(0).DefaultView dg.DataBind() Finally objconn.Close() End Try pls help me
-
solution plsThanks for ur reply I have apply the "Visible" property, but on click of the button it is going to show all the controls n again on click of the same button event those controls should not be visible? For example when we post a query in our "CodeProject" Site, by clicking on the question or replies the text will be visible and again on click of the question only the title is visible; hiding the text. In this similar fashion i want to apply for my application? So pls help me
-
solution plsHi all, I'm working on VB.Net 2003 with ASP.Net,in my application i want to place a button and on click of it, it has to show some controls and again on click of the same button the controls which r previously visible show hide (for the same button click). I'm not able to proceed further in this regard so pls help me how to proceed with this situation, if any examples are there it would be more helpful pls help me
-
Delete Query [modified]Hi Adeel, Thanx 4 ur reply, Actually the client is deleting from front end i.e VB and here i can see it through database table only, im not able to know which one he has deleted as i need to keep track of the data. when he delete any value from front end can i get a blank space on tat particular row without the next row updating the deleted row. pls do help me
-
Delete Query [modified]Hi, In my application i have a database table which my client can access, now if he deletes any particular row from it i have to know the updation but when he is deleting the next row is coming up with out showing any gap in between the row. Im using VB with SQL Server 2000 how to show empty cell space when we delete a particular row from a table in sql server?Please help me -- modified at 6:23 Wednesday 14th November, 2007
-
regular expression validatorThanx 4 ur reply, it worked
-
regular expression validatorHi, every one I have a text box where i need to fill a name so i have given a regular expression validator for the text box so that user can fill only alphabets. The expression which i gave is [A-Z]*|[a-z]*. when im giving all small letter it is working but if i give a capital letter follwed by small letters it is not working. pls help me
-
javascript for Random images pickin a page i need to pick an image randomly/sequencly n display it on the page so i have taken a javascript as below var num=1 img1 = new Image () img1.src = "images\BD\img1.jpg" img2 = new Image () img2.src = "images\BD\img2.jpg" function slideshowUp() { num=num+1 if (num==2) { num=1 } document.BD.src=eval("img"+num+".src") } i have an imag tag
with this image tag i have kept the anchor tag to A HREF="JavaScript:slideshowUp()" asp:linkbutton id=Linkbutton3 runat="server" CssClass="Small" ForeColor="Blue" Text='<%# DataBinder.Eval(Container, "DataItem.Employee_Name") %>' /asp:linkbutton /A im getting the value of "DataItem.Employee_Name" from database table. but javascript is not working for LinkButton so pls help me in this issue?
-
I have a application where i need to keep "tip of the day"In my application i need to keep "tip of the day".i have a table with a list of tips. I need to display one of the tips from database table on to the web page and it has to change every day(increment).But Same tip is coming if i'm using "Application" Please help to solve this problem.
-
Global.asax ProblemApplication("TipNumber") = 1 If Application("TipDate") <> Today() Then Application("TipDate") = Today() If Not IsNumeric(Application("TipNumber")) Then Application("TipNumber") = 1 Else Application("TipNumber") = Application("TipNumber") + 1 End If End If Dim cmd As SqlDataAdapter = New SqlDataAdapter("Select Thought From Thoughts_Tbl " & "Where id = " & Application("TipNumber"), Con) cmd.Fill(_dataSet, "TheTip") If _dataSet.Tables("TheTip").Rows.Count = 0 Then Application("TipNumber") = 1 cmd = New SqlDataAdapter("Select Thought From Thoughts_Tbl " & "Where id = " & Application("TipNumber"), Con) cmd.Fill(_dataSet, "TheTip") End If lbl_Title1.Text = "Thought of the Day :" lbl_ThoughtText.Text = _dataSet.Tables("TheTip").Rows(0).Item("Thought") This is the actual code where i'm check the date with today's day if it matches and the TipNumber is not numeric it wil take first statement Application("TipNumber") = 1 or if TipNumber is numeric i.e having some number, it wil be incremented in else part Application("TipNumber") = Application("TipNumber") + 1 but TipNumber which is incrementing is not saving? Now how to save TipNumber n incrementing it and get the next "TipOfDay" from database? Pls help me with some solution
-
Global.asax ProblemThanks for ur reply but if i want it in daily basis how to do the coding? pls help me
-
Global.asax ProblemIf Application("TipDate") <> Today() Then Application("TipDate") = Today() If Not IsNumeric(Application("TipNumber")) Then Application("TipNumber") = 1 Else Application("TipNumber") = Application("TipNumber") + 1 End If End If I have given the above code in the page and i want to store Application("TipNumber") and it has to increment daily depending up the Date Value. So, i have placed the Appliaction("TipNumber")=1 in Appliaction_Start of Global.asax but when ever the appliaction is running TipNumber is initialised to 1 only but not incrementing? Please help me in solving this problem
-
System.ArgumentException: Redirect URI cannot contain newline characters.System.ArgumentException: Redirect URI cannot contain newline characters. I'm getting this error while selecting one of the record from a datagrid using a Request.String and display the records value into another page. Pls help me in this regard.
-
Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.Thanks for ur reply. I have changed it to "sql server and windows" and also created a login for the domainname\username and in the connection string i have given "data source=domainname,intial catalog=appliactionname,persist security info=false" when im giving trusted connection=none then it is showning error while running the application itself so pls help me with some solution
-
Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.Previously i have used sql authentication for my application but due to some reasons sql server 2000 was reinstalled with mixed mode(both windows and sql authentication). when i run my application "Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection." error message is showing pls help me out
-
Abt displaying images placed in one web page randomly display each at a timeActually i have placed some images in a single webpage with visible="false" and i need to check it with date and month, if both matches then one image has to be visible and next time when date and month matches it has to show successive(next) image and hide the previous image. working on asp.net 2003 with vb.net Pls help me out.