Hi all, I have a MSSQL database with Godaddy, and I have access using the SQL Server Managements Studio, and of course their Hosting center interface with a web browser. I need a more robust backup setup. Currently I would have to manually initiate a backup. -Is there a way to automate a backup using The Sql Server Management Studio? Perhaps from my client PC (COM, DLL)? -I can't use the BACKUP command statement as the server is attempting to create the backup file on THEIR servers. The only information I'm using the database is table data. If using .NET along with the SQL database, are there any methods (that would be reasonably affective) to SELECT statement for each table in db. Then export this database to csv or other format. Appreciate your help.
David Hovey
Posts
-
MSSQL Backup database - without BACKUP command -
FileIOPermission exception with sharpPDF library writing PDF to child dir.Yes. I tried that with the below excerpt from my web.config file...The articles on this subject were very confusing, so I was hoping someone could shed light on if this is the proper direction for fix. Regarding the below config file excerpt there were some articles that had a blank "originalurl" attribute. I tried that as well, and till same exception. Could it be a trust level associated with the specific library? <system.web> <trust level="Full" originUrl="" />
-
FileIOPermission exception with sharpPDF library writing PDF to child dir.Just tried that. Didn't notice that user account, but it doesn't work. Still receive exception.
-
FileIOPermission exception with sharpPDF library writing PDF to child dir.Having problems with free PDF library sharpPDF and allowing it to write PDF file to child directory within ASP.NET application. The PDF is created just fine in my development environment but when deployed to production application (on same computer just separate folder) I receive the below exception. I tried several different things such as: - adding to my web.config file for the application. - verifying NTFS security settings on app directory. Added IIS_WPG with modify privileges. IIS_USRS had modify access already. As well NETWORK SERVICE has modify privileges. Let me know any suggestions.
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file. Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. Source Error: Line 97: } Line 98: Line 99: pDoc.createPDF(strOutputFilename); Line 100: Line 101: Response.ContentType = "Application/pdf"; Source File: D:\TerritoryServer\Workspace\WebApp\rtest.aspx.cs Line: 99 Stack Trace: [SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.] System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) +0 System.Security.CodeAccessPermission.Demand() +54 System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) +2103 System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy) +138 System.IO.FileStream..ctor(String path, FileMode mode) +91 sharpPDF.pdfDocument.createPDF(String outputFile) +82 TerritoryServer.rtest.Page_Load(Object sender, EventArgs e) in D:\TerritoryServer\Workspace\WebApp\rtest.aspx.cs:99 System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25 System.Web.Util.Cal
-
Processing webpage post (automated)Hi All! I am trying to process several requests to a website, performing posts of data and processing page results. I'm finding it seems very inefficient, and actually it seems to take longer to process the request than compared to typing in manually. Looking at the code below it appears there isn't a way to simplify or move initialization of objects to another method, rather than performing it each request is made (the requests are being made to the same website). Here is my code below. Thanks for all your help!
private string ProcessFormPOST(string strURL, string strFormData)
{
try
{
//string strViewstate = GetInitialViewState(strURL);
//strViewstate = System.Web.HttpUtility.UrlEncode(strViewstate);
//strFormData += "&__VIEWSTATE=" + strViewstate;byte\[\] buffer = Encoding.UTF8.GetBytes(strFormData); string proxy = null; System.Net.HttpWebRequest req = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(strURL); req.Method = "POST"; req.ContentType = "application/x-www-form-urlencoded"; req.ContentLength = buffer.Length; req.Proxy = new System.Net.WebProxy(proxy, true); // ignore for local addresses req.CookieContainer = new System.Net.CookieContainer(); // enable cookies System.IO.Stream reqst = req.GetRequestStream(); // add form data to request stream reqst.Write(buffer, 0, buffer.Length); //reqst.Flush(); reqst.Close(); System.Net.HttpWebResponse res = (System.Net.HttpWebResponse)req.GetResponse(); // send request, get response System.IO.Stream resst = res.GetResponseStream(); // display HTTP response System.IO.StreamReader sr = new System.IO.StreamReader(resst); return sr.ReadToEnd(); } catch (Exception ex) { throw ex; } }
-
Setup app, with single progress dialog.I have a simple C# application that performs some setup tasks and exits, once done, with no user notification. I would like to display a progress dialog showing status. Currently my setup code is in the Run method of the program instance. I could create two forms. Form A would be not visible and would perform setup tasks. Form A would create Form B that displays progress. Form A could manipulate Form B controls. This I could have done, but seems unnecessary and not proper. What I was trying to accomplish was including the setup code in the Run function of the program instance. And creating a single progress dialog there. But then I'm missing a message pump for forms? (is that correct wording). Form would not process paint events I'm guessing. Am I over-thinking this? I would like to accomplish having a thread (maybe original app thread) processing setup tasks, and a separate thread or message pump for form? To accomplish this, I think would help me in understanding more about threading and app processing. Thanks for your help!
-
Queue Processing (Database structure)Ahhh. Thank you for your 2ct's. Its great hearing different ideas as I was thinking about it from a different angle.
-
Queue Processing (Database structure)Luc, I appreciate your help. Could you clarify though the purpose of your, perhaps boolean field "record valid"? For my specific application an invalid record (perhaps incorrect address) would be moved to a different stageID or queue. Do you also have an additional purpose in mind for this "field value" status field? Thank You!
-
Queue Processing (Database structure)I'm working on a project that stores addresses, and ultimately groups them by Locality/Territories. But along with this there are different stages where an address is first keyed and is "up-for-review". Once approved it would be assigned a Locale/Territory. Along with this a further queue or holding would store Exceptions (addresses that need to marked as "Invalid"). I'm hoping to get some suggestions on how structure the tables. Currently I have the queue's separated by tables. But as I'm moving along in development this is becoming tedious. For the most part 80-90% of the field names are shared between the different tables (Queues). My thought was to avoid any possible anomalies by separating the queues into different tables. Questions: -Would you suggest using one table to store all addresses and a foreign key to determine stage or queue? -Is this a common way of storing data that is used in Queue processing? Thanks for your help!!
-
Interface and GetType() - works in C# but not in VB?Thanks Fred. Although it certainly has been awhile since I posted that. Where were you then!? hahaha. Just a joke. When I couldn't figure it out I ended up using a .NET library to keep the C# code as it was. Then as it turned out, because I needed more C# experience, I ported my program over to C# and didn't need the code in VB anyway. All kidding aside. Great work.
-
Interface and GetType() - works in C# but not in VB?Sorry but I never did find the solution. Not sure if you are using the same code I was (Providing for drag and drop from Outlook)? I ended up using the original C# code and creating a C# library that my VB program referenced. Then I ended up using an online code converter and now the program is in c# anyway... Sorry couldn't be more helpful.
-
Combobox - DrawItem and dragging scroll bar problemThanks for your help! It works now!!
-
Combobox - DrawItem and dragging scroll bar problemOk. Well here is the info I have. I changed the code quite a bit. Created a custom combobox at runtime. Form and combobox are doublebuffered. It also creates a log file showing index, bounds, and time of DrawItem method being executed. To describe the problem. It would appear that the Background is not being drawn correctly (but this only describes the appearance-I don't think this is the cause). When I quickly scroll the entire list, to the end, the majority of the items appear as a "blob" of black as if all of the items were drawn over top of eachother. The odd thing is this is intermittent. Out of the 20 items shown in the drop down maybe 3 or 4 will be displayed correctly. The log file shows that when quickly dragging through a list, the items are only being drawn on either the last or second to the last visible item bounds. When dragging up the items are only drawn on either the top or second visible item bounds. Since this is the case, internally, either Windows or the .NET framework, would have to be storing the item graphics and then be moving the previous item graphics up or down. But if you click on the scroll bar to get the next or previous "page" all the items will be redrawn from top to bottom... I uploaded the log file to my website http://www.hoveytech.com/drawitemlog.txt Not sure where to go from here. Thanks for your quick answers and continued help!
Public Class Form1
Private m_fBold As Font
Private WithEvents m_cboCustom1 As CustomComboPrivate Sub m\_cboCustom1\_DrawItem(ByVal sender As Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles m\_cboCustom1.DrawItem If e.Index = -1 Then Exit Sub End If e.DrawBackground() If e.Index Mod 4 = 0 Then e.Graphics.DrawString(m\_cboCustom1.Items(e.Index).ToString(), m\_fBold, Brushes.Black, e.Bounds) Else e.Graphics.DrawString(m\_cboCustom1.Items(e.Index).ToString(), e.Font, Brushes.Black, e.Bounds) End If LogDrawItem(e.Index, e.State, e.Bounds) End Sub Private Sub Form1\_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Me.DoubleBuffered = True m\_cboCustom1 = New CustomCombo m\_cboCustom1.Location = New Point(30, 30) m\_cboCustom1.DropDownStyle = ComboBoxStyle.DropDownList m\_cboCustom1.DrawMode = DrawMode.OwnerDrawVariable m\_cboCustom1.MaxDropDownIte
-
Combobox - DrawItem and dragging scroll bar problemThanks for the comment. You remind me to think about that more. New code is below, but issue still exists. I was thinking that perhaps I needed a custom class, that overrides the OnPaint method. This doesn't seem correct as the method would draw the part of the control that doesn't drop down. I searched for quite a while and it doesn't seem anyone else has had this problem.
Public Class Form1
Private Sub Button1\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim i As Integer For i = 1 To 200 ComboBox1.Items.Add(i) Next End Sub Private Sub ComboBox1\_DrawItem(ByVal sender As Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles ComboBox1.DrawItem If e.Index = -1 Then Exit Sub End If e.DrawBackground() e.Graphics.DrawString(ComboBox1.Items(e.Index).ToString(), e.Font, Brushes.Black, e.Bounds.X, e.Bounds.Y) End Sub
End Class
-
Combobox - DrawItem and dragging scroll bar problemHi there. I need some help with drawing items for a ComboBox Control. For the most part the ComboBox draws just fine. I can scroll up and down and everything is good. The problem is when I drag the scrollbar "thumb" or box to get through the list faster. The items do not display correctly. The ComboBox is set to DropDownList and OwnerDrawVariable. I understand the code below is not very meaningful as I could use the windows implementation to draw the items. The program I'm working on displays certain items in bold, so the code below just illustrates the problem I have. Thanks for your help!!
Public Class Form1
Private Sub Button1\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim i As Integer For i = 1 To 200 ComboBox1.Items.Add(i) Next End Sub Private Sub ComboBox1\_DrawItem(ByVal sender As Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles ComboBox1.DrawItem If e.Index = -1 Then Exit Sub End If e.DrawBackground() e.Graphics.DrawString(ComboBox1.Items(e.Index).ToString(), e.Font, New SolidBrush(Color.Black), e.Bounds.X, e.Bounds.Y) End Sub
End Class
-
Page viewing using .NET (capable of zoom, control editing)I'm working on making a report editing feature of a program I've built. The feature will contain three main sections, Design, Layout and Print Preview similar to Microsoft Access. I understand there are other options for creating reports, but this is best options for the features use in my program. If you could help with two questions regarding this: 1. Currently with the Layout view I'm using classes that inherit System.Windows.Forms.Control class. I would like to give the user the ability to zoom in and out of the Layout view. How could I implement this? Is there a different class to use than the Control base class? Would I simply need to scale the properties of the Control (font size, location, size)? 2. Currently I have two classes for each object type. For example, for Text objects I have two classes, one that contains the properties that pertain to the Text object (which provide validation for proper values). Another class inherits the Control base class and serves as the view for the Text object. This design is getting complicated. Would it be better to combine the classes and their uses into one class? I want the ability to view print preview of the report without viewing the Layout, thus would a class that inherits the Control base class be too much overhead when it will not actually be displayed on the screen? Sorry for the lengthy post. The two questions seemed tied together. Thanks for your patience... David Hovey
-
Withevents for dynamicly created controlsWorks great! thanks for your help.
-
Withevents for dynamicly created controlsHi there! I need some help with events for dynamicly created objects. The code below illustrates the problem. My situation will be a little different since the objects I will be dynamicly creating will be custom, but the problem is the same. The event will only fire on the last created object. How can I have an event fired within the form Class each time an individual instance of the label is clicked??
Public Class Form1
Friend WithEvents lbl As Label
Private i As IntegerPrivate Sub Form1\_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load i = 1 End Sub Private Sub Form1\_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp lbl = New Label lbl.Name = "lbl" & i lbl.Text = "Label " & i lbl.Location = e.Location lbl.AutoSize = True Me.Controls.Add(lbl) i += 1 End Sub Private Sub lbl\_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lbl.Click MsgBox(lbl.Text) End Sub
End Class
-
Interface and GetType() - works in C# but not in VB?Hi again. I have another question hopefully someone can help me with. I've found articles online where it is said that an Interface does not have a GetType() function as it is not derived from 'Object'. This seems true since when trying to work with the IDataObject interface, there is no GetType() function. The problem is, as my last post addresses, I'm trying to change code from C# to VB for drag and dropping from Outlook. The original C# code is shown below. The very Odd thing I don't understand is how in C# GetType() works with IDataObject. Inside the DragDrop event of an Windows Form object e.Data.GetType() is usable, but this is not the case in VB. I have the below code converted to VB but the New constructor does not work since there is no GetType() functions "visible." Thanks again!!
private System.Windows.Forms.IDataObject underlyingDataObject; private System.Runtime.InteropServices.ComTypes.IDataObject comUnderlyingDataObject; private System.Windows.Forms.IDataObject oleUnderlyingDataObject; private MethodInfo getDataFromHGLOBLALMethod; public OutlookDataObject(System.Windows.Forms.IDataObject underlyingDataObject) { //get the underlying dataobject and its ComType IDataObject interface to it this.underlyingDataObject = underlyingDataObject; this.comUnderlyingDataObject = (System.Runtime.InteropServices.ComTypes.IDataObject)this.underlyingDataObject; //get the internal ole dataobject and its GetDataFromHGLOBLAL so it can be called later FieldInfo innerDataField = this.underlyingDataObject.GetType().GetField("innerData", BindingFlags.NonPublic | BindingFlags.Instance); this.oleUnderlyingDataObject = (System.Windows.Forms.IDataObject)innerDataField.GetValue(this.underlyingDataObject); this.getDataFromHGLOBLALMethod = this.oleUnderlyingDataObject.GetType().GetMethod("GetDataFromHGLOBLAL", BindingFlags.NonPublic | BindingFlags.Instance); }
-
Interface code from C# to VB.NETHello. I am trying to implement drag and drop in my application (from Outlook messages and message attachments) I found the code on a Code Project post, but it is for C#. My application is written in VB, so I'd rather convert the code to VB than add a required DLL to what my program requires. I need help with the below lines of code. Where I need help is at the CreateStream function for example. I cannot find a equivalent for the "return" section of "[return: MarshalAs(UnmanagedType.Interface)]" Can you help me? Thanks.
\[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("0000000B-0000-0000-C000-000000000046")\] public interface IStorage { \[return: MarshalAs(UnmanagedType.Interface)\] IStream CreateStream(\[In, MarshalAs(UnmanagedType.BStr)\] string pwcsName, \[In, MarshalAs(UnmanagedType.U4)\] int grfMode, \[In, MarshalAs(UnmanagedType.U4)\] int reserved1, \[In, MarshalAs(UnmanagedType.U4)\] int reserved2); \[return: MarshalAs(UnmanagedType.Interface)\] IStream OpenStream(\[In, MarshalAs(UnmanagedType.BStr)\] string pwcsName, IntPtr reserved1, \[In, MarshalAs(UnmanagedType.U4)\] int grfMode, \[In, MarshalAs(UnmanagedType.U4)\] int reserved2); \[return: MarshalAs(UnmanagedType.Interface)\] IStorage CreateStorage(\[In, MarshalAs(UnmanagedType.BStr)\] string pwcsName, \[In, MarshalAs(UnmanagedType.U4)\] int grfMode, \[In, MarshalAs(UnmanagedType.U4)\] int reserved1, \[In, MarshalAs(UnmanagedType.U4)\] int reserved2); \[return: MarshalAs(UnmanagedType.Interface)\] IStorage OpenStorage(\[In, MarshalAs(UnmanagedType.BStr)\] string pwcsName, IntPtr pstgPriority, \[In, MarshalAs(UnmanagedType.U4)\] int grfMode, IntPtr snbExclude, \[In, MarshalAs(UnmanagedType.U4)\] int reserved); void CopyTo(int ciidExclude, \[In, MarshalAs(UnmanagedType.LPArray)\] Guid\[\] pIIDExclude, IntPtr snbExclude, \[In, MarshalAs(UnmanagedType.Interface)\] IStorage stgDest); void MoveElementTo(\[In, MarshalAs(UnmanagedType.BStr)\] string pwcsName, \[In, MarshalAs(UnmanagedType.Interface)\] IStorage stgDest, \[In, MarshalAs(UnmanagedType.BStr)\] string pwcsNewName, \[In, MarshalAs(UnmanagedType.U4)\] int grfFlags); void Commit(int grfCommitFlags); void Revert(); void EnumElements(\[In, MarshalAs(UnmanagedType.U4)\] int reserved1, IntPtr reserved2, \[In, MarshalAs(UnmanagedType.U4)\] int reserved3, \[MarshalAs(Unma