tfowler
Avatar/Signature-
Posts
85 -
Joined
-
Last visited
About tfowler
- Birthday 11/15/1971
Personal Information
-
Occupation
Software Engineer
-
Visual Studio .NET Version
Visual Studio .NET Professional 2005
-
.NET Preferred Language
VB.NET
tfowler's Achievements
Newbie (1/14)
0
Reputation
-
Export a dataset to an Excel file
tfowler replied to karmah's topic in Interoperation / Office Integration
The simplest solution I use is just to save it as a delimited text file (tab, comma, whatever), and then Excel can import it. In addition, it is not limited to Excel. Todd -
Not that I've used it much, but it looks like all you need to do is specify the Data Source (path to the file) and Password (if it is password protected). You also may need to add a reference to "System.Data.SqlServerCe". You can then access your database through a SqlServerCe.SqlCeEngine object: Code: Dim connection As New SqlServerCe.SqlCeConnection("Data Source=C:\MySqlServerCompactDb.sdf;Password=password") Dim command As New SqlServerCe.SqlCeCommand("SELECT * FROM MyTable", connection) connection.Open() Dim results As SqlServerCe.SqlCeDataReader results = command.ExecuteReader(CommandBehavior.CloseConnection) or something like that. Todd
-
I noticed that you edited your question after Nate had answered, so I thought I would help get Nate's point across: What he means is that you did something like this: Public Class Form Private Sub Form_Load() Handles Form.Load Dim person1, person2, person3, person4 As String '<= NOTE: personX are local to Form_Load person1 = "Guy1" person2 = "Guy2" person3 = "Guy3" person4 = "Guy4" End Sub Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged TextBox2.Text = person1 End Sub End Class What you need to do is: [left][color=#b1b100]Public Class Form Dim person1, person2, person3, person4 As String '<= NOTE: personX are now local to all of the Form class Private Sub Form_Load() Handles Form.Load person1 = "Guy1" person2 = "Guy2" person3 = "Guy3" person4 = "Guy4" End Sub Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged TextBox2.Text = person1 End Sub End Class [/color] [/left]
-
I've used iTextSharp to print directly to a PDF (not convert from DOC). The documentation is not that great, but I was able to figure things out on my own relatively easily. It definitely took some trial and error.
-
Are you using Visual Studio.NET? If so, select Project -> Add Windows Form and select the About Box template. If not, you'll have to design your own new form. Then you'll have to instantiate the Form and call WhateverYouNameTheForm.ShowDialog() in the Click event of your "About 5th G" menu item. Todd
-
I've recently started to use LinqToSql. So far, it has been working very well to automatically create business objects from the database tables.
-
Inserting Data: Technique Question
tfowler replied to joe_pool_is's topic in Database / XML / Reporting
I can't tell you why they do that. My first couple of applications used the SqlDataAdapter method too. I don't remember when I figured out that it was overkill for what I was trying to accomplish. Yes. You would create your SELECT statement to only return Column2 and then do something like: VAL2 = cmd.[size=2]ExecuteScalar() [/size] Of course ExecuteScalar returns an object, and so it would need to convert it to your needed data type. Look into the ExecuteReader method. If you want an example, I can give you one later, but I gotta go right now. Todd -
Inserting Data: Technique Question
tfowler replied to joe_pool_is's topic in Database / XML / Reporting
Why use a SqlDataAdapter at all? I usually do it something like this: string insert = "INSERT INTO Table2 ([Column1], [Column2], [Column3]) " + "VALUES (@VAL1, @VAL2, @VAL3)"; SqlCommand cmd = new SqlCommand(insert, m_db); m_db.Open(); try { cmd.Parameters.Add("@VAL1", SqlDbType.VarChar, 20).Value = strValue1; cmd.Parameters.Add("@VAL2", SqlDbType.VarChar, 20).Value = strValue2; cmd.Parameters.Add("@VAL3", SqlDbType.VarChar, 20).Value = strValue3; int nCount = cmd.ExecuteNonQuery(); if (nCount != 1) { Console.WriteLine(string.Format("{0} records were affected.", nCount); } } catch (SqlException e) { Console.WriteLine(e.Message); } finally { cmd.Dispose(); m_db.Close(); m_db.Dispose(); } assuming that m_db is your SqlConnection object. Todd -
"You won't find a more feature-rich, stable and reliable service for the price."
-
A little Googling got me this link: http://www.jcxsoftware.com/ Todd
-
Performing a count on an additional table.
tfowler replied to mike55's topic in Database / XML / Reporting
I've done something similar to this in the past. I think it would be something like: SELECT dbo.Organization.Org_ID, dbo.Organization.Org_Name, dbo.SMS_Credit.Credit, CONVERT(VARCHAR(10), dbo.Org_MemberShip.Start_Date, 103) AS Start_Date, CONVERT(VARCHAR(10), dbo.Org_MemberShip.Finish_Date, 103) AS Finish_Date, dbo.Org_MemberShip.Status, dbo.Org_MemberShip.Subscription_Type, dbo.Organization.Org_Country, dbo.Organization.DialingCode, dbo.Organization.Org_Email, dbo.Organization.Org_Phone, dbo.Organization.Addr1, dbo.Organization.Town, dbo.Organization.County, dbo.Organization.Member_Numb, dbo.Login.Email_Add, dbo.Login.UserName, dbo.Login.PlainPass, dbo.Org_Profile.AllowContact, dbo.Login.Login, dbo.Login.Forename, dbo.Login.Surname, message_count= (SELECT COUNT(dbo.SentMessages.org_id) FROM dbo.SentMessages WHERE dbo.SentMessages.org_id=dbo.Organization.Org_ID) FROM dbo.Organization INNER JOIN dbo.Org_MemberShip ON dbo.Organization.Org_ID = dbo.Org_MemberShip.Org_ID INNER JOIN dbo.SMS_Credit ON dbo.Organization.Org_ID = dbo.SMS_Credit.Org_ID INNER JOIN dbo.Login ON dbo.Organization.Org_ID = dbo.Login.Org_ID INNER JOIN dbo.Org_Profile ON dbo.Organization.Org_ID = dbo.Org_Profile.Org_ID where (Org_Membership.Subscription_Type = 'trial' or Org_Membership.Subscription_Type = 'full') Todd -
Try the opensource tool iTextSharp (http://itextsharp.sourceforge.net/). The documentation isn't very clear (since it was ported from a Java tool), but once you get it working, it works very well. I've used it for a couple of projects. Todd
-
The "Dim strPath..." statement gets the path to the directory from which the application is executing (which is obviously where he expects to find his XML data). The "dsEquip.ReadXmlSchema..." statement gets the schema information for the XML file. A schema file describes the structure of an XML file. For instance, when you save a DataSet to an XML file using DataSet.WriteXml, with the XmlWriteMode.WriteSchema option, it will create a schema file for you that defines such things as: which nodes are the tables vs which nodes are the columns, etc. If you do not have a schema file, the DataSet.ReadXml method has to try to figure out the schema from the data. If unsuccessful, you either get an exception, or no data in the DataSet. Todd
-
Ok, I have searched the web forever for this and found suggestions, but none of them seem to work for my stituation. So, here I am. I am using AJAX.NET 1.0. I have a page with two UpdatePanels. The first contains a DropDownList and three Panels which contain various controls. When the user selects an item from the DropDownList, the appropriate Panel is displayed, while the others are hidden. This works great. The second UpdatePanel control contains a GridView. Right-clicking and dragging on the GridView paints the cells different colors (using a JavaScript routine) depending on the selection in the DropDownList. This works great when the page first loads, but stops working after a different item is selected from the DropDownList. I have read a variety of threads about using ScriptManager.RegisterClientScriptBlock to register my JavaScript code. I have tried to do this in Page_PreRender, Page_Load, UpdatePanel1_PreRender, UpdatePanel1_Load, UpdatePanel2_PreRender, UpdatePanel2_Load, and all of the combinations at once...but I can't get it to work! I'm at a complete loss. My JavaScript looks something like: [size=2]<script language="javascript" type="text/javascript">[/size] [size=2]/* script for changing the background color of the table cells based on the "Selection Mode" */[/size] [size=2]document.getElementById('<%GridView1.ClientID %>').onmousemove = MouseMove;[/size] [size=2]document.getElementById('<%GridView1.ClientID %>').onmousedown = MouseMove;[/size] [size=2]document.getElementById('<%GridView1.ClientID %>').oncontextmenu = DontShowContext;[/size] [size=2]document.getElementById('<%GridView1.ClientID %>').onmouseup = MouseUp;[/size] [size=2]// handle the MouseMove event for the GridView control[/size] [size=2]function MouseMove(event)[/size] [size=2]{[/size] [indent][size=2]:[/size][/indent] [indent][size=2]:[/size][/indent] [indent][size=2]WITH THE CODE TO CHANGE COLORS HERE[/size][/indent] [size=2][[/size]/code] So, registering all of the JavaScript using [b]ScriptManager.RegisterClientScriptBlock[/b] doesn't work because I get errors about the GridView object not existing (since it hasn't been rendered yet). So, I split the non-funtion code out and try to register it using [b]ScriptManager.RegisterStartupScript[/b]. I no longer get the script errors, but I am back to the original problem! Thanks for any help you can provide, Todd http://forums.asp.net/emoticons/emotion-7.gif
-
I'm not sure where you got the instructions to enable AJAX in your application, but you seem to be missing a lot in your web.config file. Check out this video tutorial: http://www.asp.net/learn/videos/view.aspx?tabid=63&id=81 He goes through the entire process of adding AJAX capability to an existing site. Once the AJAX web.config information is added, you need to add a ScriptManager control to the page. Then add an UpdatePanel control (and ContentTemplate) that surrounds the Panel control, along with the Button control you will use to control the Panel visibility. Let me know if you need more details, Todd