No More Solutions

You can find a lot of debugging and deploying problems while developing applications in .NET and Visual Basic here. There are also some querying tips in SQL and typical source codes which might be useful shared here.

Unable to start debugging on the web server

Error : Error while trying to run project: Unable to start debugging on the web server. Server side-error occurred on sending debug HTTP request.

Make sure the server is operating correctly. Verify there are no syntax errors in web.config by doing a Debug.Start without Debugging. You may also want to refer to refer to the ASP.NET and ATL Server debugging topic in the online documentation.

This error appears as a dialog box while trying to debug a web application.

Solution : Run the application without debugging. You can :
1. Use Ctrl + F5, not F5, or
2. Directly type the URL address on the browser, or
3. Open IIS by pressing window + R, then type inetmgr, expand the web application under development, and browse it

You'll see the source of the error.

In a case I met, it's because of the unavailability of an impersonate user on the computer, while in the web.config, an impersonate user is used.

In case you meet the same condition; and in the web.config, there exists such code as:

<identity impersonate="true" username="uploaduser" password="uploaduser">



Go to Computer Management by pressing Window + R, then type "compmgmt.msc" (without quotes) -> Expand Local Users and Groups -> Users. If the user : uploaduser defined in web.config does not exist there, make the user by right-clicking, New User -> fill the user's information. Otherwise, if the user already exists, make sure that the account is not disabled. Just enable it by going to the properties if it is currently disabled.
Bookmark and Share

Making table of contents in ms. word 2007

There are times when we need to make table of contents after making an article. It would be quite troublesome to make it manually if the article is long enough. Fortunately, if you're writing it in ms. office, there has been a functionality provided for it.

Here is a video about how to make table of contents using ms. word 2007. It should be more or less the same using earlier or later version of ms. word ^^


Bookmark and Share

Retrieving Tables and Columns in a Database

This is how to retrieve tables & columns in the table from a database:


Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
Set rs = con.OpenSchema(adSchemaColumns)

While Not rs.EOF
Text1.Text = Text1.Text & rs!Table_Name & " - " & rs!COLUMN_NAME & vbCrLf
rs.MoveNext
Wend

Bookmark and Share

Retrieving Tables in a Database

This is how to retrieve all tables in a database:
Object needed:
A Textbox named Text1


Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
Set rs = con.OpenSchema(adSchemaTables)
While Not rs.EOF
If rs!Table_Type = "TABLE" Then Text1.Text = Text1.Text & rs!TABLE_NAME & vbCrLf
rs.MoveNext
Wend

Bookmark and Share

How to get column names of a table

This is how to retrieve column / field names of a table from VB using adodb connection:


con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\database.mdb;Persist Security Info=False"

Set rs = New ADODB.Recordset
sql = "select * from table_name"
Set rs = con.Execute(sql)

Dim i As Integer
For i = 0 To rs.Fields.Count - 1
MsgBox rs.Fields(i).Name
Next

Bookmark and Share

CustomError mode

Error :

Server Error in '/' Application.
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".

<!-- Web.Config Configuration File -->

<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>


Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customerrors> configuration tag to point to a custom error page URL.

<!-- Web.Config Configuration File -->

<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>

Solution : The exact error hidden in this error message may vary. To reveal and see the error, changing the customErrors mode is necessary.
In web.config, change to mode to RemoteOnly or Off.
Changing the mode to RemoteOnly will enable the error message to be displayed when the web is viewed on the server.
Meanwhile, changing the mode to Off will enable the error message to be displayed when the web is viewed either on the server of outside.


<customErrors mode="Off" defaultRedirect="ErrorPage.aspx">
<error statusCode="404" redirect="ErrorPage.aspx?errNo=404"/>
</customErrors>
Bookmark and Share

Error detected by database DLL

Error : Error detected by database DLL

This error occurs when trying to open report produced using Crystal Report in application, one of which is application developed using VB.

Solution :
1. If you are using ODBC, make sure the ODBC has been created.

Here are the steps to create ODBC for the connection to the database, press Window + Run, then type "ODBCAD32" (without quotes). Then, on the User DSN tab, press Add.

A dialog box will be shown:



Click the Add button and choose SQL Server.




Insert the name of the database and server.




Next, if you're using SQL Server authentication, insert the login ID and password; otherwise, choose Windows Authentication.





2. If you've created the ODBC in User DSN tab, and still get the error, try doing step 1 again for the System DSN tab while creating the ODBC.

3. If still, it does not work, check the query used in your report, and make sure the stored procedure used in the report (in case you are using stored procedure) has been granted for the application itself. This is sometimes forgotten by developer ^^
To grant the stored procedure to the database user used in the application:
grant exec on spr_spname to database_user_name

Bookmark and Share

Adding web reference in Visual Studio 2008 or later

Some people get confused adding web reference in Visual Studio 2008 or later, since it's not by default in the Solution explorer. Only Service reference is shown.

Web reference is actually still available on Visual Studio 2008 or later.
Just right-click on the project where the web reference is to be added, choose Add Service Reference, then click Advanced button. Click Add Web Reference beneath, then insert the URL address of the web service, Go. If the URL address is correct, it will be shown in the listbox saying "Web services found at this URL". Insert the reference name, then click Add Reference, OK.

That's all folks ^^
Bookmark and Share

Operation is not allowed when object is closed

Error: Operation is not allowed when object is closed.

Solution:
1. Check if a recordset or connection is opened before recordset operation is performed.

2. If stored procedure is used while retrieving the data to recordset, REMEMBER to use "SET NOCOUNT ON" at the beginning of the stored procedure. This is a problem which usually occurs when multiple actions are executed in a stored procedure.

3. Again, if stored procedure is used, make sure the stored procedure does return a record. Otherwise, make sure there is a routine in the code checking if the record doesn't return nothing.

e.g.

create procedure dbo.spr_getData
as
set nocount on

select ......

select ......

set nocount off
Bookmark and Share

Posting to blog from Ms. Office 2007

You can directly post to your blog without having to go your blog first.

Simply open your Microsoft Word 2007, then choose New -> New Blog Post.

Bookmark and Share