Navigation

Search

Categories

On this page

CSS Style
How do you move a WSS 3.0 database to a different SQL Server?
Connection String has not been properly iniitialized
An Overview of ASP.NET 3.5 and Visual Studio 2008
Database Connection Strings
Finding a column name in SQL Server
Exporting Data from Excel in a Gridview
Client Confirmation to a GridView Delete
CSS Tools and Links
Development Tools
Checkbox in a gridview which turns the selected row a different color when checked

Archive

Blogroll

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

RSS 2.0 | Atom 1.0 | CDF

Send mail to the author(s) E-mail

Total Posts: 112
This Year: 50
This Month: 0
This Week: 0
Comments: 0

Sign In

 Sunday, December 09, 2007
Sunday, December 09, 2007 8:13:24 PM (Eastern Standard Time, UTC-05:00) (  |  )

 

This dumb post is just for my own reference.  This catch-all CSS references uses a font style that I like for all of the most common HTML page elements.

body, input, select, textarea, button {font-family:Verdana, sans-serif; font-size:x-small}
 Saturday, November 24, 2007
Saturday, November 24, 2007 12:51:00 PM (Eastern Standard Time, UTC-05:00) ( )

 

I know this issue is going to come up soon for me so I've been researching possible solutions and came across this one.

http://wss.asaris.de/sites/walsh/Lists/WSSv3%20FAQ/DispForm.aspx?ID=1034

How do you move a WSS 3.0 database to a different SQL Server?

You cannot move the configuration database. 

1.  Detached the content database using SQL Manager

2.  Copied the database and log files to the new server

3.  Attached the content database to the new server

4.  Run the SharePoint Products and Technologies Configuration Wizard to remove it from the farm

5.  Run SharePoint Products and Technologies Configuration Wizard to recreate the farm and add the new database server. This will also create a
new configuration database.

6.  Once that is done, go to SharePoint Central Administration website and click on Application Management

7.  Select Create or extend web application to setup your new web application

8.  Select Content Database and add the new content database

9.  Restart IIS

 Wednesday, November 21, 2007
Wednesday, November 21, 2007 12:45:26 PM (Eastern Standard Time, UTC-05:00) (  |  |  )

I Was recently asked to move a standalone application inside of WSS 3.0. No matter what I tried I was getting an error message "Connection String has not been properly iniitialized" even though it worked fine in a separate app. The problem turned out to be that the first version which worked in version 1.1 does not work ASP.NET 2.0. In the first example, the connection string is pulling it's connection info from the <AppSettings> section. Version 2.0 doesn't use <appsettings> and instead uses <ConnectionStrings> so the SqlConnection and SqlCommand objects have to be structured a little differently.

********************

My typical method which worked fine in a separate app but did not work in WSS:

Dim strSQLText As String = "SELECT UserID, Name FROM tblUsers ORDER BY Name"
Dim con As SqlConnection = New SqlConnection(ConfigurationSettings.AppSettings("QCentralConnectionString"))
Dim cmd As New SqlCommand(strSQLText, con)
con.Open()
ddluserID.DataSource = cmd.ExecuteReader()
ddluserID.DataBind()
con.Close()

web.config:

<appSettings>       
    <add key="QCentralConnectionString" value="server=localhost; database=QCentral; uid=xxx; pwd=xxx" />   
</appSettings>

********************

This version worked in WSS 3.0 (ASP.NET 2.0):

Dim strSQLText As String = "SELECT UserID, Name FROM tblUsers ORDER BY Name"
Dim con As New SqlConnection(ConfigurationManager.ConnectionStrings("QCentralConnectionString").ConnectionString)
Dim cmd As New SqlCommand(strSQLText)
con.Open()
cmd.Connection = con
ddluserID.DataSource = cmd.ExecuteReader()
ddluserID.DataBind()
con.Close()

web.config:

<configuration>
<connectionStrings>
<clear />
<add name="QCentralConnectionString" connectionString="Data Source=localhost;Initial Catalog=QCentral;User ID=xxx;Password=xxx" providerName="System.Data.SqlClient" /> 
</connectionStrings>

********************

Wednesday, November 21, 2007 12:31:46 PM (Eastern Standard Time, UTC-05:00) ( )

Scott Mitchell provides a summary of the new features of ASP.NET 3.5 and Visual Studio 2008.  It turns out there aren't a lot of differences between ASP.NET versions 3.5 and 2.0. These are the main new features of version 3.5

  • Integrated ASP.NET AJAX support,
  • The ListView control, and
  • The DataPager control

I'm very happy to see that with Visual Studio 2008 you are able to target which version of .NET you want to code against. This was a real plan with VS 2003 vs VS 2005.

http://aspnet.4guysfromrolla.com/articles/112107-1.aspx

 Wednesday, November 14, 2007
Wednesday, November 14, 2007 9:31:10 AM (Eastern Standard Time, UTC-05:00) ( )

This is the most comprehensive site I've come across for creating connection strings for pretty much any database type you can think of

http://www.connectionstrings.com/

Technorati Tags: ,
 Tuesday, November 13, 2007
Tuesday, November 13, 2007 12:21:03 PM (Eastern Standard Time, UTC-05:00) (  |  )

Use this to find out where a given field name or column reside and is being used in SQL Server.

select so.name
from sysobjects so inner join syscolumns sc
ON so.id = sc.id where sc.name = 'YourColumnNameGoesHere'

or

select so.name, sc.name
from sysobjects so inner join syscolumns sc
ON so.id = sc.id where sc.name like '%YourPartialColumnNameGoesHere%'

or

Select table_name from information_Schema.columns where column_name='yourCol'

 

 Monday, November 12, 2007
Monday, November 12, 2007 8:49:16 PM (Eastern Standard Time, UTC-05:00) ( )

I recently ran into a situation where I was unable to export data from a GridView to Excel using the same technique that I've used many times before using a DataGrid (see below).  I kept getting the error message "Control 'GridView1' of type 'GridView' must be placed inside a form tag with runat=server. "  I had to do this to get this to work.

<script runat="server">
Private Sub ExcelExport(ByVal sender As System.Object, ByVal e As System.EventArgs)
GridView1.AllowSorting = False
Response.Clear()
Response.AddHeader("content-disposition", "attachment;filename=ConferenceAttendees.xls")
Response.Charset = ""
Response.ContentType = "application/vnd.xls"
Dim stringWrite As System.IO.StringWriter = New System.IO.StringWriter()
Dim htmlWrite As System.Web.UI.HtmlTextWriter = New HtmlTextWriter(stringWrite)
GridView1.RenderControl(htmlWrite)
Response.Write(stringWrite.ToString())
Response.End()
End Sub
</script>

The trick

was to set EnableEventValidation to false in the page declaration:

<%@ Page Language="VB" EnableEventValidation = "false" %>

Technorati Tags: ,,
Monday, November 12, 2007 8:41:08 PM (Eastern Standard Time, UTC-05:00) (  |  )
Client Confirmation to a GridView Delete
Monday, November 12, 2007 4:48:10 PM (Eastern Standard Time, UTC-05:00) ( )

Here are a few CSS tools and links that I came across that look useful

 Friday, November 09, 2007
Friday, November 09, 2007 9:40:05 PM (Eastern Standard Time, UTC-05:00) ( )

Here are a few of development tools I've found useful

  • RegExDesigner.NET - A tool for building and testing regular expressions in .NET
  • Fiddler - Fiddler is a HTTP Debugging Proxy which logs all HTTP traffic between your computer and the Internet. Fiddler allows you to inspect all HTTP Traffic, set breakpoints, and "fiddle" with incoming or outgoing data. It's very similar to Firefox tool, Firebug. I found it very helpful with writing javascript that makes any type of XmlHttp calls.
  • IE Development Toolbar - This one's very cool. Check out the Overview section for everything that it does.
 Thursday, November 08, 2007
Thursday, November 08, 2007 8:57:04 PM (Eastern Standard Time, UTC-05:00) ( )

This example is a gridview contains a checkbox which when checked turns the selected row a different color.  

<asp:GridView ID="MyGridView" runat="server">
<Columns>
<asp:TemplateField>
    <ItemTemplate>
       <asp:CheckBox ID="MyCheckBox" runat="server" AutoPostBack="true" OnCheckedChanged="CheckBox1_CheckedChanged" />
    </ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
  Dim DataTable As New Data.DataTable
  DataTable.Columns.Add("Column1", GetType(String))
  DataTable.Columns.Add("Column2", GetType(String))
  Dim DataRow As Data.DataRow = DataTable.NewRow
  DataRow.Item(0) = "Test1"
  DataRow.Item(1) = "Test2"
  DataTable.Rows.Add(DataRow)
  MyGridView.DataSource = DataTable
  MyGridView.DataBind()
End If
End Sub

Protected Sub CheckBox1_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs)
  Dim checkbox As CheckBox = CType(sender, CheckBox)
  Dim row As GridViewRow = CType(checkbox.NamingContainer, GridViewRow)
   If checkbox.Checked = True Then
     row.BackColor = Drawing.Color.Red
     mygridview.Columns(0).Visible = False
   End If
End Sub