Tuesday, January 02, 2007

ASPNet account and SQL Server

If you use Integrated Security = True in the DB connection string for a website, make sure that the machine's ASPNET account( machine name\aspnet account ) has access to the database.

Very simple information but effective at times.

Tuesday, December 19, 2006

FTP using IE

You can use IE to do neat FTPs
use ftp://username@IP address
This should work fine. No command line arguments

Thursday, December 07, 2006

Remote connections to SQL Server 2005 Express

Try connecting a SQL server 2005 Express server from a remote machine, you would get an error.

Error would be something like this
============================
Message : An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 28 - Server doesn't support requested protocol)

This is because the default setting for SQL server 2005 Express allows local connections only.

For configuring the remote connections ,

  1. go to the SQL Server Surface area configuration application and click on Remote connections,select Local and Remote connections
  2. Restart the SQL Server service


SQL Server 2005 - Adding an user

Should be a very basic stuff for most.
But it took me sometime.Therefore blogging it so that I do not waste a minute in it later on
  1. Add the user to the server level by ensuring that in the User Mapping section ( Right click Properties ) , the default schema for the databases is dbo.
  2. The role membership in the User Mapping section ( Right click Properties ) should be db_owner
  3. Go to the respective database such as Pubs where the user has been added say user1
  4. Right click the properties of user1
  5. Ensure that the section( Schemas owned by the user ) has the db_owner checked
  6. Ensure that the section( Database role membership) has the db_owner checked

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.