|
Hello sir,
I would like to thanks for the immediate response
but I still have error when I try your code
I still got this error
"Object is not an ADODB.RecordSet or an ADODB.Record. Parameter name: adodb"
I'm a bit confuse now or anything coz I think the codes is right
by the way sir I am using visual studio team system 2008
and microsft access 2007 as my database.
Thanks,
dfan23
|
|
|
|
|
OK. use this code:
Private Sub Sampler_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ds = New DataSet("dataSet")
dt = New DataTable()
ds.Tables.Add(dt)
con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" + _
"Data Source = c:\Sadsign.mdb"
con.Open()
sql = "SELECT * FROM [Names]"
da = New OleDb.OleDbDataAdapter(sql, con)
da.Fill(dt)
'con.Close()
'MaxRows = ds.Tables("contacts").Rows.Count
'inc = -1
End Sub
seems that "Names" is a reserved keyword. Hence the error.
|
|
|
|
|
Hello,
Thanks for the immediate response sir.
Now I know that Name/Names are not valid as variable names.
If would you mine sir I would like to ask how to add a new row
to my database then how to update the changes made into the database.
I have a code for adding a new row but still got error in updating it.
The Error is "Syntax error in INSERT INTO statement."
below here is my code:
da = New OleDb.OleDbDataAdapter(sql, con)
cb = New OleDb.OleDbCommandBuilder(da)
Dim newRow As DataRow
newRow = ds.Tables("employeeTable").NewRow
ds.Tables("employeeTable").Rows.Add(newRow)
newRow.Item("Position") = comboPosition.Text
newRow.Item("Last_Name") = txtLastName.Text
newRow.Item("First_Name") = txtFirstName.Text
da.Update(ds, "employeeTable")
Thanks,
dfan23
|
|
|
|
|
dfan23 wrote: Now I know that Name/Names are not valid as variable names.
Is your problem sorted? then rate the answer.
dfan23 wrote: If would you mine sir I would like to ask how to add a new row
to my database then how to update the changes made into the database.
I have a code for adding a new row but still got error in updating it.
Looks to me that you should read some textbooks for this...or atleast google how to work with datatables.
here is an nice link that i learnt from... guess u would like it too. http://www.dotnetfunda.com/articles/article131.aspx[^]
|
|
|
|
|
Hello, sorry for reposting this
Thanks for the immediate response sir.
Now I know that Name/Names are not valid as variable names.
If would you mine sir I would like to ask how to add a new row
to my database then how to update the changes made into the database.
I have a code for adding a new row but still got error in updating it.
The Error is "Syntax error in INSERT INTO statement."
below here is my code:
<pre>da = New OleDb.OleDbDataAdapter(sql, con)
cb = New OleDb.OleDbCommandBuilder(da)
Dim newRow As DataRow
newRow = ds.Tables("employeeTable").NewRow
ds.Tables("employeeTable").Rows.Add(newRow)
newRow.Item("Position") = comboPosition.Text
newRow.Item("Last_Name") = txtLastName.Text
newRow.Item("First_Name") = txtFirstName.Text
da.Update(ds, "employeeTable")</pre>
Thanks,
dfan23
|
|
|
|
|
Buddy there can be many things wrong here.
You haven't created a commandbuilder here.
commandbuilder can only work when there is a primary key in the database.
Why don't you read some books before posting these kind of questions here. These are one of the most basic questions available in any textbook which teach VB.net with SQL
any code which works with sql will work with msAccess too except for using a OleDbConnection instead of SqlConnection
|
|
|
|
|
Hello,
thanks for the help I kindly appreciate your suggestions,
I have read some vb.net books but some are using the drag and
drop system , but I wanted to try also coding all the connections.
Thanks again,
dfan23
|
|
|
|
|
|
Hello,
Thanks for your help and suggestion.
|
|
|
|
|
I have a VB.Net application that references a DLL written in VC++. This is a critical application and must run. Sporadically (about once a week) the application generates a message with the app name as title with the text "<app> has encountered a problem and needs to close..." and the buttons "Debug" and "Close" at the bottom. The problem here is that I need to know that the application has generated the message so that I can kill it and restart it immediately. I have tried to send a message to an auxilliary application that monitors the main app, but since it is in a timed loop, the message is sent even if the debug message is shown, so as far as the aux. app is concerned, everything is just fine.
I have disabled the JIT debug script and tried everything I know of to get around this. It seems that Microsoft insists on giving you a message whether you want it or not.
Sitting and waiting for the error to occur is not an option and the log files I have put into the program don't tell me what stopped it. The DLL is the source of the problem.
What I need is a way of disabling the runtime debug message so that the program just dies, so it can be detected and restarted, or barring that, a way of having a separate program detect that the main program has entered into this state, so it can be killed and restarted.
Note: If you are going to mention the painfully obvious and tell me that I should fix the DLL, trust me - I've tried and will keep trying. You'll be wasting your time and mine. I just need an interim solution that will keep the application running. TIA
|
|
|
|
|
|
He said not to mention the painfully obvious
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Now that i think of it, "painfully obvious and tell me that I should fix the DLL" seems to be a good idea
|
|
|
|
|
To both of you:
Actually, the code has try...catch structures everywhere. It had been working for a year when the first problem occurred. All attempts to duplicate it here have failed because we don't have the money to duplicate the hardware. Extra log messages have been introduced, but don't point to the problem. The reason just fixing the dll is not a viable option is that it would required me waiting on site for one to two weeks until the error happened again, if at all - again, no money for that. Remote login is not possible.
The problem may have something to do with the fact that try...catch doesn't work with WIN32 exceptions starting with VS 2005.
I must say, this forum used to have people who actually tried to help. Your petty sarcasm is both uncalled for and counter-productive. If you are incapable of offering anything positive, please don't answer at all.
|
|
|
|
|
fdmaxey wrote: I must say, this forum used to have people who actually tried to help. Your petty sarcasm is both uncalled for and counter-productive. If you are incapable of offering anything positive, please don't answer at all.
Hi,
I would like to offer a Sorry for being sarcastic... but your question didn't sound as serious/clear/professional as your this comment. It sounded like someone has made a program, got it installed and just cannot handle it.
Anyways. there are only two solutions that I can think of.
1. Adding try/catch block in your main method. If at all any error happens, it should be caught within main method.
2. http://msdn.microsoft.com/en-us/library/d21c150d.aspx[^] It talks about how to disable exception methods.
Other than these, i cannot think of an other options. Sorry... May be someone else can improve on this answer.
|
|
|
|
|
Hi,
I need my .net application written in vb.net to communicate to or process a application that runs on a mainframe system. Is there any possibility in achieving this? I need no API to be involved or any other services such as CICS/HIS or socket programming.
Thanks in advance.
|
|
|
|
|
Prabhanand Nagarajan wrote: I need my .net application written in vb.net to communicate to or process a application that runs on a mainframe system.
Your .NET application runs on a PC, your mainframe app runs on a mainframe. The only way I know to communicate from one to the other is via some communication method such as sockets, serial port etc.
MVP 2010 - are they mad?
|
|
|
|
|
Maybe COBOL.NET fits your needs?
Learning without thought is labor lost; thought without learning is perilous. (Confucius)
|
|
|
|
|
Hi folks,
I'm in need of your advice. I'm trying to create a screenshot from a c# application. This works well as long as I use my code within a standard desktop application. What we really need is a windows service taking screenshots. I tried Graphics.CopyFromScreen and the code in here Capturing the Screen Image in C# to grab an image but all I get back is a black image. Not even the dimension is correct.
The service was started with LocalSystem and desktop interaction allowed.
What did I miss? Any hints?
I can provide the sources If it helps...
Thank's in advance and best regards,
Stevie
Greetings,
Stephan Eberle
hawke@deltacity.org
|
|
|
|
|
As far as I know, starting with Vista, interactive
services aren't allowed.
Can you run a windowless app in the user session?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi everybody,
i'm currently developping a website using 3 tier architecture, i've been requested that the controls of the presentation layer should be loaded and customized via an XML file. To behonest i'm new to XML and I made some researches and i didn't succeeded.
Could anyone help me with this either by providing an example or some document?
shold i use teh web.config file?
thank you in advance for your usual help
|
|
|
|
|
|
thank you for your answer,
is there any other way without using the XSLT file ?
|
|
|
|
|
Sure, you could write the parsing and interpreting of the XML yourself (C# whatever) and incorporate it in your application.
However XSLT is specific to XML input so it's a natural candidate if you want to generate HTML on the fly.
The example I sent you uses a pattern.
If your pages do not exhibit such patterns it will become harder to customize using XML.
michael_jhons wrote: the controls of the presentation layer should be loaded and customized via an XML file
That's kind of an unbounded requirement.
What must be customized?? Position? Colour? Size?
Maybe just stylesheets will do the trick for you.
Dependent on the actual requirements you can make a choice how your solution will look like.
|
|
|
|
|
thank you for your help, i'll give it a try
|
|
|
|