Showing posts with label cant. Show all posts
Showing posts with label cant. Show all posts

Monday, March 19, 2012

Another simple prob I cant fig out

I have a table w/ 17K line items. There are only 8.5k I want because each one is duplicated exactly twice. How do I get one of each of these line Items into a new Table?

I tried this:

Select DISTINCT * from DuplicateTable INTO NewTable

And it doesnt work. I am still getting the 17K transported over... any solutions?Since you got the full 17K items, there is something that is different about the whole row. Pick a pair of "duplicates, and set them side by side. You should be able to pick out a difference, whether it be an identity column, GUID column, or just some detail column that is not part of what should have been the primary key. Good luck.

Saturday, February 25, 2012

Annoying, cant insert into DB for some reason, even using a stored procedure.

Hello, I am having problems inserting information into my DB.

First is the code for the insert


Sub AddCollector(Sender As Object, E As EventArgs)
Message.InnerHtml = ""

If (Page.IsValid)

Dim ConnectionString As String = "server='(local)'; trusted_connection=true; database='MyCollection'"
Dim myConnection As New SqlConnection(ConnectionString)
Dim myCommand As SqlCommand
Dim InsertCmd As String = "insert into Collectors (CollectorID, Name, EmailAddress, Password, Information) values (@.CollectorID, @.Name, @.Email, @.Password, @.Information)"

myCommand = New SqlCommand(InsertCmd, myConnection)

myCommand.Connection.Open()

myCommand.Parameters.Add(New SqlParameter("@.CollectorID", SqlDbType.NVarChar, 50))
myCommand.Parameters("@.CollectorID").Value = CollectorID.Text

myCommand.Parameters.Add(New SqlParameter("@.Name", SqlDbType.NVarChar, 50))
myCommand.Parameters("@.Name").Value = Name.Text

myCommand.Parameters.Add(New SqlParameter("@.Email", SqlDbType.NVarChar, 50))
myCommand.Parameters("@.Email").Value = EmailAddress.Text

myCommand.Parameters.Add(New SqlParameter("@.Password", SqlDbType.NVarChar, 50))
myCommand.Parameters("@.Password").Value = Password.Text

myCommand.Parameters.Add(New SqlParameter("@.Information", SqlDbType.NVarChar, 3000))
myCommand.Parameters("@.Information").Value = Information.Text

Try
myCommand.ExecuteNonQuery()
Message.InnerHtml = "Record Added<br>"
Catch Exp As SQLException
If Exp.Number = 2627
Message.InnerHtml = "ERROR: A record already exists with the same primary key"
Else
Message.InnerHtml = "ERROR: Could not add record"
End If
Message.Style("color") = "red"
End Try

myCommand.Connection.Close()

End If

End Sub

No matter what I get a "Could not add record" message

Even substituting the insert command string with my stored procedure I would get the same thing

Stored Procedure:


CREATE Procedure CollectorAdd
(
@.Name nvarchar(50),
@.Email nvarchar(50),
@.Password nvarchar(50),
@.Information nvarchar(3000),
@.CustomerID int OUTPUT
)
AS

INSERT Collectors
(
Name,
EMailAddress,
Password,
Information
)

VALUES
(
@.Name,
@.Email,
@.Password,
@.Information
)
GO

Can anyone see any problems with this code? It looks good to me but I get the same message always.

ThanksWhy not print out the actual exception text (exp.ToString(), for instance)? Then the exception will tell you why.|||Wow, nice little trick. It helped me find the problem. I had an expected parameter in the SP that I was not supplying.

Thank You

Friday, February 24, 2012

AND - OR Sql syntax problem

Need a OR clause in the below statement but can't get it right.

Existing:

WHERE(L_PicTable.PicCity = @.PicCity)AND(L_PicTable.PicState = @.PicState)AND(L_PicTable.LinkType ='C')AND(L_PicTable.PicEnabled = 1)

NEED it to be:

WHERE(L_PicTable.PicCity = @.PicCity)AND(L_PicTable.PicState = @.PicState)AND(L_PicTable.LinkType ='C' ORL_PicTable.LinkType ='CS')AND(L_PicTable.PicEnabled = 1)

Can't get this clause to work - are my ('s wrong?

AND(L_PicTable.LinkType ='C' ORL_PicTable.LinkType ='CS')

Try with this:

L_PicTable.LinkType =N'C' OR L_PicTable.LinkType =N'CS'

|||

zoltac007:

AND(L_PicTable.LinkType ='C' ORL_PicTable.LinkType ='CS')

You can useANDL_PicTable.LinkType in ( 'C' ,'CS' ). One more thing, you don't need to place each and every AND clause in a separate pair of braces, they are used just when you want the output ( true or false ) to be returned back considering a set of the conditions as a whole.

|||

Hello zoltac,

There's no problem with the ()'s.

Your clause rewritten in boolean logic is:

(L_PicTable.PicCity = @.PicCity)AND(L_PicTable.PicState = @.PicState)AND (L_PicTable.LinkType ='C') AND(L_PicTable.PicEnabled = 1)

OR

(L_PicTable.PicCity = @.PicCity)AND(L_PicTable.PicState = @.PicState)AND (L_PicTable.LinkType ='CS') AND(L_PicTable.PicEnabled = 1)

What is the statement supposed to do?

Jeroen Molenaar.

|||

I am trying to select all records where Enabled is true, City, State match the page parameters AND the LinkType is either C or CS. There are only three values for the LinkType field, C, S or CS.

Monday, February 13, 2012

Analysis Services Plugin Debug

Hi!

I am working on an AS Algorithm Plugin . I want to debug it in the AS Server, but I cant figure out how it works. Now I every time install and deploy the plugin, but if I catch an exception, it just shows me the message, not the stack trace. Anyone, something friendlier method?

Sorry for my poor English!

Bye,
Laci

To debug, just attach the debugger to the msmdsrv.exe process.

Do you use managed or native code to implement your plug-in? Also, are you using one of the samples or developing from scratch? If you provide more details, there could be some easier ways to catch errors

|||Thank You. It fully solved my problem! Smile

Analysis Services Plugin Debug

Hi!

I am working on an AS Algorithm Plugin . I want to debug it in the AS Server, but I cant figure out how it works. Now I every time install and deploy the plugin, but if I catch an exception, it just shows me the message, not the stack trace. Anyone, something friendlier method?

Sorry for my poor English!

Bye,
Laci

To debug, just attach the debugger to the msmdsrv.exe process.

Do you use managed or native code to implement your plug-in? Also, are you using one of the samples or developing from scratch? If you provide more details, there could be some easier ways to catch errors

|||Thank You. It fully solved my problem! Smile

Analysis Services Install - Add. componets not found.

I'm trying to install Analysis Services, and we have a full enterprise msdn
set,
but when I go to add additional components I can't fine Analysis Services on
the April 2004 cd available. It doesn't appear to be listed.
Anyone have an idea of what's up with that?
KenM
Hi Ken,
Can you check "Analysis Services" item in the same screen as "add
Additional Components" of the same sqlserver installation cd?
Thanks,
Dutta
"KenM" wrote:

> I'm trying to install Analysis Services, and we have a full enterprise msdn
> set,
> but when I go to add additional components I can't fine Analysis Services on
> the April 2004 cd available. It doesn't appear to be listed.
> Anyone have an idea of what's up with that?
> KenM
|||Hi, thanks for the reply., and
Nope. That's the problem. I come to the screen that has two boxes in it
showing components and sub-components and no matter where I click I can not
find "Analysis Services" anywhere.
I have an academic version of the msdn enterprise and am installing it to
get MS Project Services on a Win2003 server.
Just can't seem to find it.
Any help will be appreciated.
Ken
"Chandan DUtta" wrote:
[vbcol=seagreen]
> Hi Ken,
> Can you check "Analysis Services" item in the same screen as "add
> Additional Components" of the same sqlserver installation cd?
> Thanks,
> Dutta
>
> "KenM" wrote:
|||Its actually on the very first screen with SQL Install
starts. The same one that says "Install SQL"
It is not in the "Add additional components" screen with
some other Checkboxed items.

>--Original Message--
>Hi, thanks for the reply., and
>Nope. That's the problem. I come to the screen that has
two boxes in it
>showing components and sub-components and no matter where
I click I can not
>find "Analysis Services" anywhere.
>I have an academic version of the msdn enterprise and am
installing it to[vbcol=seagreen]
>get MS Project Services on a Win2003 server.
>Just can't seem to find it.
>Any help will be appreciated.
>Ken
>"Chandan DUtta" wrote:
screen as "add[vbcol=seagreen]
installation cd?[vbcol=seagreen]
a full enterprise msdn[vbcol=seagreen]
fine Analysis Services on[vbcol=seagreen]
listed.
>.
>