Thursday, November 23, 2006

VB Express error - Strange solution

Today I was working with VB express and did the following
  • Created a new permission set
  • Created a new code group
  • Associated the code group with the permission set.
  • Created a strong name for the simple windows app that I was working with.
  • Associated the assembly with the code group

Then after doing such simple things got the following error while trying to debug








And then what next ?
Googled .
Found in the MSDN forums that there were many souls like me who had racked their brains on this.
Solution:
===========
Turn on the Terminal Services from the Control Panel->Settings->Services.
And the VB Express works like a charm as before .
Strange isnt it ? I will research more if you find why this is so. Any of you reading this can post comments on this.

Tuesday, November 21, 2006

Local SQL Server 2005 DB and Enterprise DAB

Experiment1
============
Add a SQL database from the Solution explorer using Add New item.
Once you add it , the connection string would be present in the app.config
add name="My.MySettings.Database2ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=DataDirectory\Database2.mdf;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient"


Use the Enterprise Library DAB and change the default database to point to My.MySettings.Database2ConnectionString
dataConfiguration defaultDatabase="My.MySettings.Database2ConnectionString"

Experiment2
===========

You can also have a .MDF and a .LDF file in the file system as in
C:\Ambarish\Database2.mdf

Change the connection string in the app.config to
add name="My.MySettings.Database2ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Ambarish\Database2.mdf;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient"

=========================================================



Use the MVC pattern ( here only the controller code is present ) to connect to the DB

============================================
Public Sub GetTable1Data(ByRef ds As DataSet)
Dim db As Database
Dim strCommand As String
Dim dbCommand As DbCommand
Try
db = DatabaseFactory.CreateDatabase()
strCommand = "dbo.uspGetDataTable1"
dbCommand = db.GetStoredProcCommand(strCommand)
ds = db.ExecuteDataSet(dbCommand)
Catch ex As Exception
Throw ex
Finally
db = Nothing
End Try
End Sub


==============================

Monday, October 23, 2006

Wednesday, October 11, 2006

SQL Server Express XCOPY

The XCOPY feature of SQL Server Express is a good feature which would help applications to deploy databases very easily.
This is similar to deploying Microsoft Access databases

Sample code from the 101 VB samples (VB101SamplesWinForms\UsingDataGridView)
on how to connect to MDF files have been added
======================================================
Dim connectStringBuilder As New SqlConnectionStringBuilder()
connectStringBuilder.DataSource = ".\SQLEXPRESS"
connectStringBuilder.AttachDBFilename = "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\AdventureWorks_Data.mdf"
connectStringBuilder.IntegratedSecurity = True
connectStringBuilder.UserInstance = True

==========================================
Some very good links are as follows:

Tuesday, October 10, 2006

Asynchronous Tasks in .NET 2.0

In .NET 2.0, a new class BackgroundWorker Class has been introduced.
This would help in Asynchronous Tasks.
These are paricularly helpful when there is a long running task such as downloading a file,uploading a file,printing a large number of documents.

Good links are as follows:
====================

TreeView articles

Some of the good treeview links
=============================
  1. http://www.codeproject.com/vb/net/TreeViewDragAndDrop.asp is a good link for implementing Drag and Drop. Follow the links in the page to have other good treeview links.

Monday, October 09, 2006

Web Services Performance

1. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wse3.0/html/4344d43e-ceb4-43a9-8f8c-6a3f89f786bd.asp. This is “How to: Enable a Web Service to Send and Receive Large Amounts of Data”
2. How to: Stream Large Amounts of Data from a Web Service . The URL is http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wse3.0/html/4344d43e-ceb4-43a9-8f8c-6a3f89f786bd.asp
3. http://www.codeproject.com/soap/MTOMWebServices.asp

are good links relating to Web Services and uploading and downloading data
Adda is the Bengali for discussion.Bengali is a language like English.