Showing posts with label spent. Show all posts
Showing posts with label spent. Show all posts

Wednesday, March 28, 2012

problems with sqlreader

Hi everyone,

I am writing a simple login application in asp 2.0. I have spent quite a little bit of time of this error so any help would be greatly appreciated.

Here is the code i am using.

Dim cnAs SqlConnection

Dim cmdAs SqlCommand

Dim sqlAsString ="select password from attendant where " & _

" ((username = @.username) and (password = @.password)"

cn =

New SqlConnection("Data Source=z-davis\sqlexpress;Initial Catalog=Trainingdb;Integrated Security=True")' cn = New SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings("TrainingdbConnectionString").ToString)

'I have tried both connection strings and get the same error.

cmd =New SqlCommand(sql, cn)

cmd.Parameters.Add(

"@.username", SqlDbType.VarChar, 50)

cmd.Parameters(

"@.username").Value = txtuser.Text

cmd.Parameters.Add(

"@.password", SqlDbType.VarChar, 50)

cmd.Parameters(

"@.password").Value = txtpass.Text

cn.Open()

Dim myreaderAs SqlDataReader

myreader = cmd.ExecuteReader(CommandBehavior.CloseConnection)

'The line above is where i get the error.

If myreader.Read()Then

FormsAuthentication.RedirectFromLoginPage(txtuser.Text,

False)Else

Response.Write(

"Try again")

After stepping through the code the error stops on this line:

myreader = cmd.executereader(commandbehavior.closeconnection)

The error that is generated is: Incorrect syntax near ')'

Any help would be greatly appreciated or any other code snippets

Thanks,

notrosh

In this line you have 3 open parentheses and only 2 close parentheses.

Dim sqlAsString ="select password from attendant where " & _

" ((username = @.username) and (password = @.password)"


Remove the first open parenthesis and you will have better luck.

|||

Thanks,

Sometimes you need an outside eye to see an error that simple.

zach davis

|||Or you need to have made that same sort of error a few dozen timesWink [;)]

I've learrned to count my parentheses using my fingers. Working left to right in my SQL statement, I put up a finger each time I open one, and put down a finger each time I close one. When I get to the last character, if I have any fingers sticking up, I know I have a problem. Pretty silly approach, but it works for me.

Friday, March 9, 2012

Problems with Excel COM and msiInstaller

Hello there

I have spent some days now trying to solve this problem and I didn't find a solution yet. So, may be there is somebody out having solved this issue...

I am using Excel on a server. But it seems that there are problems between the DCOM and the NT AUTHORITY/NETWORK SERVICE. The event viewer is showing two warnings each time the excel is started:

- Event ID: 1015
Description: Failed to connect to server. Error: 0x8007005
- Event ID: 1004
Description: Detection of product '{90120409-6000-11D3-8CFE-0150048383C9}', feature 'ExcelUserData', component '{8ADD2C96-C8B7-11D1-9C67-0000F81F1B38}' failed. The resource 'HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Excel\UserData' does not exist.

Both of them have the source "Msiinstaller".

I really could use some help solving this problem... I tried a lot and nothing did work.

Thanks a lot

I think you may have put this in the wrong group...... this group is for SQL Server Reporting Services Tool.|||

Juan,

Were you able to find a way out from this issue ? I am experiencing the same. If you have followed anything or found some info, please forward it to me (franklinissac@.hotmail.com).

Thanks,

Franklin

Problems with Excel COM and msiInstaller

Hello there

I have spent some days now trying to solve this problem and I didn't find a solution yet. So, may be there is somebody out having solved this issue...

I am using Excel on a server. But it seems that there are problems between the DCOM and the NT AUTHORITY/NETWORK SERVICE. The event viewer is showing two warnings each time the excel is started:

- Event ID: 1015
Description: Failed to connect to server. Error: 0x8007005
- Event ID: 1004
Description: Detection of product '{90120409-6000-11D3-8CFE-0150048383C9}', feature 'ExcelUserData', component '{8ADD2C96-C8B7-11D1-9C67-0000F81F1B38}' failed. The resource 'HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Excel\UserData' does not exist.

Both of them have the source "Msiinstaller".

I really could use some help solving this problem... I tried a lot and nothing did work.

Thanks a lot

I think you may have put this in the wrong group...... this group is for SQL Server Reporting Services Tool.|||

Juan,

Were you able to find a way out from this issue ? I am experiencing the same. If you have followed anything or found some info, please forward it to me (franklinissac@.hotmail.com).

Thanks,

Franklin