|
What is the value of SQL at the time of the exception?
topcoderjax - Remember, Google is your friend.
|
|
|
|
|
Hey TCJ, thanks for your reply. According to the VB watch window this is the value of my SQL..."Delete * FROM Pat20VisitDate WHERE VisitMRNo='8822' AND VisitDate='12/12/2000'"
|
|
|
|
|
Answered in another post, but for other users with a similar problem # signs need to be around dates.
Other rules for access sql text:
dates should be the date with pound signs ex. #08/25/06#
boolean should be true or false (no quotes) ex. true
numbers should be just the number(no quotes) ex. 25
text is enclosed in single quotes ex. 'Test'
topcoderjax - Remember, Google is your friend.
|
|
|
|
|
CCG3 wrote: VisitMRNo
I'd guess this is a number, and you're passing it as a string ( so remove the quotes )
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
No, VisitMRNo is setup as a Text so I am passing it a string. But just so you know, I have already tried that. I have tried this with no quotes on either of them and on neither of them and I still get the same message.
|
|
|
|
|
Is there an easy way to take a program written in VB.net for the windows desktop platform and convert it to the Pocket PC?
For example I have a simple blackjack program I wrote for a class and was thinking of converting it over so I could load it onto my PPC as a test before I attmept to do it with a more complex project I am working on.
Is it worth trying or should I just rewrite it?
David Wilkes
|
|
|
|
|
Why not try it? If you get a monster list of errors, pick through them and see what they affect. Then you can judge weather it's worth fixing or a rewrite. What's the worst that can happen?
|
|
|
|
|
Tried adding the form to the PPC project but ended up with more errors than code. Was hoping there was a tool or macro that would convert from one to the other.
Luckily all of the classes and most of the sub's/functions can be cut/paste with only minor modifications. The tedious part is getting the forms set up with all of the controls and getting them named correctly.
Thanks anyway,
David Wilkes
|
|
|
|
|
Hi!
I am looking for the code that write a string to the Textbox of a other Program.
I find out, that I can activate a other open Program by :
"AppActivate(Program)"
and write there something by :
"My.Computer.Keyboard .SendKeys(XYstring)"
if there is any textbox activated.
And now the Question: is it possible to activate in this other "Program" a certain Textbox?
Just the hope that accidently the right textbox is activ is not enough.
Hans-Christian
|
|
|
|
|
Maybe. It depends on the other program. If it is possible, it's with great difficulty.
You have to find the window handle of the application is question, then traverse the window tree to find the window handle of the textbox in question. Then you can pass that window handle to the Win32 function ShowWindow (I think!) to give it the input focus. Then you can TRY to stuff keystrokes into it with SendKeys.
There is a problem with this though. You cannot guarantee that the focus will stay in that window in the time it takes to go from focusing that window and stuffing the keyboard. You could very well end up stuff those keys into another window!
A better method would be to use the Win32 function SetWindowText to put the string into that window.
But, the hardest part of this is going to be getting the handle of that textbox. You have to be very familiar with the windows in that application (not the visual part you see on the screen, but the parent/child relationship of the variable controls in those windows!
In short, you simply don't have that much control over the visual elements of another application.
|
|
|
|
|
As the previous poster said, it can be done with great difficulty. If you decide to delve into the Win32API, I would strongly recommend a book by Dan Appleman "Visual Basic Programmer's Guide to the Win32 api". It is a superb api reference documenting a significant number of the underlying windows api's and how the OS works at an api level. It was written for VB4-6 so any code examples have to be adjusted language wise for vb.net/c#, but as a C# programmer I can tell you I've never found a better api reference.
topcoderjax
|
|
|
|
|
You might want to try replying to the original poster. That way, he'll get an email you replied.
|
|
|
|
|
Thanks... Guess I assumed that as the original poster he would get all traffic on the post.
topcoderjax - Remember, Google is your friend.
|
|
|
|
|
Nope. Only the person you reply to gets the notifications.
|
|
|
|
|
Reposting the following just in case it wasn't received:
As the previous poster said, it can be done with great difficulty. If you decide to delve into the Win32API, I would strongly recommend a book by Dan Appleman "Visual Basic Programmer's Guide to the Win32 api". It is a superb api reference documenting a significant number of the underlying windows api's and how the OS works at an api level. It was written for VB4-6 so any code examples have to be adjusted language wise for vb.net/c#, but as a C# programmer I can tell you I've never found a better api reference.
topcoderjax
topcoderjax - Remember, Google is your friend.
|
|
|
|
|
Visual Basic 2005 Express:
My app checks the website to see if a new version is available.
How can I have it link to MyApp.msi on the website to download and install it if a new version is available?
|
|
|
|
|
I may be wrong, but doesn't ClickOnce deployment already support doing this? I don't konw for sure since I have very little use for ClickOnce in my environment.
|
|
|
|
|
I don't like ClickOnce, I am using a Windows Installer Setup project to deploy.
|
|
|
|
|
Then you'r going to have to write the code to check a website yourself. The website should have an XML file for version information and a download package available. This package would have to be unpacked and installed on the client side, but from a seperate executeable, not your main EXE. This is because you can't overwrite an EXE while it's running.
The web information can be had by using the WebRequest class, along with downloading the file. Launching a seperate process is easy with the Process class. XML file processing is also easy with the XmlDocument class and XPath.
|
|
|
|
|
Hi Everyone:
This problem has been plaguing me for three days, and I can’t for the life of me find a logical reason why this problem occurs.
My problem occurs when I try to write data into a dataset that contains nothing more than the table schema.
This subroutine is supposed to write a new record into the dataset.
Private Sub New_Bindings(ByVal intOrdinal As Integer, _
ByVal strCode As String, _
ByVal strName As String)
tblBindings = MyDataSet.Tables("tblBindings")
drCurrent = tblBindings.NewRow()
drCurrent("Ordinal") = intOrdinal
drCurrent("BindingCode") = strCode
drCurrent("BindingName") = strName
tblBindings.Rows.Add(drCurrent)
End Sub
I write new data into the dataset when this subroutine is activated. It is activated when the Private Sub BindingNavigatorAddNewItem_Click event is triggered: The AddNew Button on the BindingNavigator control on the form.
Private Sub BindingNavigatorAddNewItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BindingNavigatorAddNewItem.Click
Call New_Bindings(1, "SDLS", "Saddle-stitch")
Call New_Bindings(2, "SPRL", "Spiral Bound")
Call New_Bindings(3, "STUL", "Staple Upper Left")
Call New_Bindings(4, "STUR", "Staple Upper Right")
Call New_Bindings(5, "ST2L", "Two Staples on left side")
End Sub
The dataset’s data should read like this:
BindingID – 1
Ordinal – 1
Code – SDLS
Name – Saddle-stitch
BindingID – 2
Ordinal – 2
Code – SPRL
Name – Spiral Bound
BindingID – 3
Ordinal – 3
Code – STUL
Name – Staple Upper Left
BindingID – 4
Ordinal – 4
Code – STUP
Name – Staple Upper Right
BindingID – 5
Ordinal – 5
Code – ST2l
Name – Two Staples on Left Side
What I am actually getting is:
BindingID – 0
Ordinal – 1
Code – SDLS
Name – Saddle-stitch
BindingID – 1
Ordinal – 2
Code – SPRL
Name – Spiral Bound
BindingID – 2
Ordinal – 3
Code – STUL
Name – Staple Upper Left
BindingID – 3
Ordinal – 4
Code – STUP
Name – Staple Upper Right
BindingID – 4
Ordinal – 5
Code – ST2l
Name – Two Staples on Left Side
For some reason when the first record is written out to the dataset the auto increment field (BindingID) is not incremented to one when the record is written. It has an ID of “0” which logically can’t happen when the column has been defined to be an auto increment column starting at one and incrementing by one every time a new record is added.
Can anyone tell me why this is happening and what I need to do to correct it?
Thanks,
Quecumber256
|
|
|
|
|
Quecumber256 wrote: tblBindings = MyDataSet.Tables("tblBindings")
drCurrent = tblBindings.NewRow()
drCurrent("Ordinal") = intOrdinal
drCurrent("BindingCode") = strCode
drCurrent("BindingName") = strName
tblBindings.Rows.Add(drCurrent)
Wow I just saw something here.
You need to do the following instead.
drCurrent = MyDataSet.Tables("tblBindings").NewRow()
drCurrent("Ordinal") = intOrdinal
drCurrent("BindingCode") = strCode
drCurrent("BindingName") = strName
MyDataSet.Tables("tblBindings").Rows.Add(drCurrent) That is one issue. The other I still cant see based on what you provided.
CleaKO
"Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)
|
|
|
|
|
Cleako:
Just to let you know I appreciate your help.
I tried your fix. I still get the same results. Therefore I'm providing you the entire code for the data entry form. I hope this give you enough information to see what is causing the first record to not be recorded properly.
Option Explicit On
Imports System.Data.SqlClient
Public Class frmBindings
Private Msg As String
Private strSQL As String
'Declare the SQLDataAdapter and DataSet objects
Private daBindings As New SqlDataAdapter()
Private MyDataSet As New DataSet()
Dim tblBindings As DataTable
Dim drCurrent As DataRow
Private Sub Clear_Form()
txtBindingCode.Text = Nothing
txtBindingName.Text = Nothing
txtOrdinal.Text = Nothing
End Sub
Private Sub Load_DataSet()
'Connect to the SQL Server database
Dim cn As SqlConnection = New SqlConnection((My.Settings.PrintsByMe_DevConnectionString))
cn.Open()
'Retrieve the data using a SQL statement
strSQL = "SELECT * FROM [tblBindings];"
Dim cd As New SqlCommand(strSQL, cn)
'Set the database connection for MySqlDataAdapter
daBindings.SelectCommand = cd
'Fill the DataSet and DataSet Schema
daBindings.FillSchema(MyDataSet, SchemaType.Source, "tblBindings")
daBindings.Fill(MyDataSet, "tblBindings")
'Close database connection
cn.Close()
'Set the BindingNavigator's DataSource to the DataSet we created.
bsBindings.DataSource = MyDataSet
'Set the BindingSource Datamember to the table we are using.
bsBindings.DataMember = MyDataSet.Tables(0).TableName()
'Bind form control txtBindingID to the BindingID field
txtBindingID.DataBindings.Add("Text", bsBindings, "BindingID")
'Bind form control txtOrdinal to the Ordinal field
txtOrdinal.DataBindings.Add("Text", bsBindings, "Ordinal")
'Bind form control txtBindingCode to the BindingCode field
txtBindingCode.DataBindings.Add("Text", bsBindings, "BindingCode")
'Bind form control txtBindingName to the BindingName Field
txtBindingName.DataBindings.Add("Text", bsBindings, "BindingName")
End Sub
Private Sub New_Bindings(ByVal intOrdinal As Integer, _
ByVal strCode As String, _
ByVal strName As String)
drCurrent = MyDataSet.Tables("tblBindings").NewRow()
drCurrent("Ordinal") = intOrdinal
drCurrent("BindingCode") = strCode
drCurrent("BindingName") = strName
MyDataSet.Tables("tblBindings").Rows.Add(drCurrent)
'Call Clear_Form()
End Sub
Private Sub btnClose_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles btnExit.Click
Me.Close()
End Sub
Private Sub frmBindings_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
Call Load_DataSet()
naviBindings.BindingSource = bsBindings
End Sub
Private Sub BindingNavigatorAddNewItem_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles BindingNavigatorAddNewItem.Click
'Call New_Bindings(CInt(txtOrdinal.Text), txtBindingCode.Text, txtBindingName.Text)
Call New_Bindings(1, "SDLS", "Saddle-stitch")
Call New_Bindings(2, "SPRL", "Spiral Bound")
Call New_Bindings(3, "STUL", "Staple Upper Left")
Call New_Bindings(4, "STUR", "Staple Upper Right")
Call New_Bindings(5, "ST2L", "Two Staples on left side")
End Sub
End Class
Thanks again,
Quecumber256
|
|
|
|
|
I dont think you're doing anything wrong, at least nothing obvious. Just curious, have you actually tried to send the updated dataset to the database to see what happens?
CleaKO
"Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)
|
|
|
|
|
No, I haven't. In a prior message I tried to add new records to the end of the dataset. I was afraid to commit the updates because the dataset was hosed up.
Secondly - I need to add another button to the BindingNavigator control for updating purposes. I have to create a new image(Update) for this new button to indicate that when this button is activated it will commit the updates to the SQL Server database. I also need to write the updating code. I have put this off until I'm satisfied that the data in the dataset is represented properly.
Thanks,
Quecumber256
|
|
|
|
|
Im just curious if the database/dataadapter connection will help resolve the ID issue because you have to think of other situations where a company has 15 apps going all with in memory datasets, how does it resolve the ID's when they're updated? It has to let SQL Server or whichever database handle the "REAL" ID's (or at least I would think so).
CleaKO
"Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)
|
|
|
|