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


==============================
Adda is the Bengali for discussion.Bengali is a language like English.