|
Not sure if this belongs here or the databases forum.
Interesting little problem this one. I am creating a list (of string) of statements to be inserted into a database table in SQL Compact (v3.1)
listParams.Add("INSERT INTO [SYS_tbl_SelectText] ([SQLTitle],[SQLStatement]) VALUES ('APPTHISTORY','SELECT SDD_tbl_Appointments.AppointmentDate AS [Appt Date], SDD_tbl_Appointments.AppointmentStart AS [Starts], SDD_tbl_Appointments.AppointmentEnd AS [Ends], (SDD_tbl_Employees.FirstName+' '+SDD_tbl_Employees.LastName) AS [With], SDD_tbl_Treatments.Description AS [Treatment], SDD_tbl_Appointments.FullyPaid AS [Paid], SDD_tbl_Appointments.ValueGross AS [Value], SDD_tbl_Appointments.GrossOutStanding AS [Value Outstanding], SDD_tbl_Appointments.GoodsOutstanding AS [Goods Outstanding] FROM SDD_tbl_Appointments INNER JOIN SDD_tbl_Employees ON SDD_tbl_Appointments.EmployeeID = SDD_tbl_Employees.EmployeeID INNER JOIN SDD_tbl_Treatments ON SDD_tbl_Appointments.TreatCode = SDD_tbl_Treatments.ID')")
It goes into the list just fine, but when the contents of the list are executed, this particular one causes an error:
There was an error parsing the query. [ Token line number = 1,Token line offset = 276,Token in error = +SDD_tbl_Employees.LastName) AS [With], SDD_tbl_Treatments.Description AS [Treatment], SDD_tbl_Appointments.FullyPaid AS [Paid], ]
Any ideas how to resolve this? It seems it does not like the +' '+
|
|
|
|
|
I don't know about SQL Compact, though I assume the syntax is standard T-SQL, but from looking at your code you have a select statement inside quotes. Starting from
TheComputerMan wrote: 'SELECT SDD_tbl_Appointments.AppointmentDate
so the +' '+ will act as a terminator for that string.
Try using + CHAR(13) + instead of +' '+ .
If you have knowledge, let others light their candles at it.
Margaret Fuller (1810 - 1850)
www.JacksonSoft.co.uk
|
|
|
|
|
Hi, yes this is placing a statement text into a database table. There are many ' characters in the statements but I only get a problem when using the +.
Incidentally the identical code in SQL Server 2005 (as opposed to Compact) does not cause a problem - this is where the SELECT statement is used in the same format as part of an execute to create a stored procedure. In this the +' '+ goes straight in with no problem, but I have not tried storing it I must admit, only executing it.
|
|
|
|
|
Hi,
i start my application as standard User and check for updates, if Updates were available then the application restarts with admin rights (process.start) this works fine!
Next I need to uninstall a software
StartInfo.Arguments = Arguments & ProductCode
StartInfo.FileName = "msiexec.exe"
StartInfo.UseShellExecute = True
StartInfo.Verb = "runas"
UninstallProcess.StartInfo = StartInfo
UninstallProcess.Start()
Dim res As Long = WaitForSingleObject(UninstallProcess.Handle, &H4E20)
when the function WaitForSingleObject calls the main process of the update software exit but the msiexec process finished correctly???
I also tried using --> instead of WaitForSingleObject
While UninstallProcess.WaitForExit(100)
Application.DoEvents()
End While
and also tried using a Delegate Function which check if the Process has exited (UninstalledProcess.HasExited)
but nothing worked!!!
Issues with WaitForExit and Delegate Functions are on Vista x32 and Vista x64 systems, when I use WaitForSingleObject this works with Vista x64
On XP i have no problems with the WaitForExit function
Has anybody an idea how i get rid of this issue???
|
|
|
|
|
The only time I've ever run into this, I had to wait for the process to start before calling WaitForExit.
|
|
|
|
|
I have query for insert by parameters
"INSERT INTO Employee (EMPID, FirstName, LastName)VALUES(@EMPID, @FirstName, @LastName)"
Now what I need I want to give a restriction that any "EMPID Is Not Null" and "EMPID <>Space(15)" only can store to the table.
So how to restrict that?
Any Ideas?
Thanks
PARAMU
|
|
|
|
|
It depends how the value that you feed to the @EMPID parameter is created.
Does it come from a query itself or from a textbox or other windows control?
My advice is free, and you may get what you paid for.
|
|
|
|
|
Add a constraint on the [EMPID] column of the [Employee] table;
ALTER TABLE [Employee]
ALTER COLUMN [EMPID] BIGINT NOT NULL
One defines these checks on the table-level, not for each query. This has the advantage that you can write any number of queries, and still have one single check
The other restriction is also done by creating a new check-constraint on the [Employee] table. You can read more on constraints here[^], there's also an example check-constraint on that page.
I are Troll
|
|
|
|
|
my VBA program:
Private Declare Function FunctionA Lib "A.DLL" (ByVal objptr As Long, ByRef B As STRUCTA) As Integer
Private Type STRUCTA
ID(1 To 5) As STRING
Num(1 To 6) As STRING
End Type
...
Dim longa As long
Dim INFO() As STRUCTA
ReDim INFO(4) As STRUCTA
str = FunctionA (longa, INFO(0))
...
C++ program
struct STRUCTA
{
char* ID[5];
char* NumID[6];
}
DLL_EXPORT int __stdcall FunctionA(long a, STRUCTA* IDInfo)
{ ...
IDInfo[0].ID[0] = "123";
IDInfo[1].ID[0] = "456";
...
}
however,the value of INFO(0).ID(0) is "123",but the value of INFO(1).ID(0) is not "456" but "".
I feel only INFO(0)'s value is updated.
why?
how can I do to update INFO(1)-INFO(3)?
help me!
thanks!
|
|
|
|
|
My VB6/VBA is really rusty, but in your structure, I believe you created two arrays of strings, not two string variables as the structure is expecting.
|
|
|
|
|
you mean in vba:
Private Type structa
Nam As String*5
Number As String*6
End Type
?
|
|
|
|
|
this method is maybe error
have any else method ?
|
|
|
|
|
I haven't touched VB6 in 8 years, ever since I got my hands on the .NET 1.0 Beta.
|
|
|
|
|
|
sir
i am making labels at runtime form .
I have one button on runtime form when i press this button then labels create now i want to change that labels text at runtime form.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim rc As ResizeableControl
Dim LocXPosition As Integer = 20
Dim LocYPosition As Integer = 20
Dim textbox As New TextBox
'Dim intTotalRec As Integer
Static i As Integer
If i = 0 Then 'to check that how many times this has been called
i = i + 40
Else
i = i + 20
End If
textbox.Location = New Point(i, i)
Me.Controls.Add(textbox)
textbox.Text = "test"
textbox.BorderStyle = BorderStyle.FixedSingle
rc = New ResizeableControl(textbox)
End Sub
|
|
|
|
|
please, please, don't flood this forum with your ignorance, your inability to write a decent question, and your total disregard for any sort of personal advancement. You are out of your depth, obviously. Just ask one intelligent question, for one problem, and that after you try to read your books, or do some research.
How do you expect to access these textboxes ( which are not labels ), if you don't keep a reference to them ? you could iterate over your controls collection, but there is no chance in hell of you understanding that code, so instead, just keep a list of textboxes as you create them, so you can interact with them later.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Insults are not welcome Mr. Christian Graus
Pleas dont behave like this because I dont think so you have any idea that what their Journey is ALL about
please if you cant help some then dont humiliate also
Best Of Regards,
SOFTDEV
Sad like books with torn pages, sad like unfinished stories ...
|
|
|
|
|
softdev_sup wrote: Insults are not welcome Mr. Christian Graus
ROTFL !!! Apparently, the truth hurts.
softdev_sup wrote: Pleas dont behave like this because I dont think so you have any idea that what their Journey is ALL about
please if you cant help some then dont humiliate also
I know what the journey is all about. It's about people with no idea how to write any code whatsoever, taking jobs they can't do, and then asking us to do the work. The guy asked the same question three times, each time the subject was more and more ridiculous, and the guy plainly has no clue what he was doing. I gave him the best advice he could possibly hope to hear. He needs to either give up, or he needs to buy a book and learn some basics.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
$10 says he's making a 'virus'...
(See Rajdeep.Net for rofls)
|
|
|
|
|
You've developed ERP's for hospitals and financial accounting systems and your post revolves around critisism of someone who has 60,000 posts and has been an MVP, let's see here, for the following years:
1 Jan 2009: CodeProject MVP 2009
1 Jan 2008: CodeProject MVP 2008
1 Jan 2007: CodeProject MVP 2007
1 Jan 2006: CodeProject MVP 2006
1 Jan 2005: CodeProject MVP 2005
??
Why didn't you just answer his question, surely you where able to given your background?
Perhaps you might want to review the previous threads and posts to garner a history before making a comment and assuming someone was rude?
|
|
|
|
|
There is no denying Christian's technical knowledge and competence in the field, but I actually agree with oftdev_sup. Sometimes it is better not to say anything rather than dent the confidence of, and humiliate an obvious beginner. We were all beginners at some point (some of us still are), and these forums are a great tool to progress, and people should be comfortable to ask questions, no matter how ridiculous some people may think they are, without being ridiculed.
|
|
|
|
|
Again, perhaps you may need to consider the history of posts within a few hours of Christians reply, you will see he received help, but just continuously repeated his posts, oft in a vague and non-descriptive manner.
|
|
|
|
|
Christian's response to the first post I have found from this guy is, well, lets just say it's less than supportive.
|
|
|
|
|
hahaha , i am not here for buttering a bigger and thicker tree gives more and more shadow , no heart feelings , in 7 years career 3 erps and other projects i thinks so are not bad , beleives on Quality rather then quantity
I really respects Christian Grausand have learnt alot from his posts and i am reading his posts even before when he was not mvp but from few days i saw some change so i posted , dont give it a different color and make it an issue , its your wrong perception
Best Of Regards,
SOFTDEV
Sad like books with torn pages, sad like unfinished stories ...
|
|
|
|
|
Research the AddHandler command.
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|