|
Thank you , for your suggestions.
But , i make more simple my question :
i'm a beginner on working with vb.net + sql server. Until today , i have developped several application in MS Access (backend + frontend).
But now i want to make something in vb.net+ sql server. Someone suggest to use typed dataset because
is more easy for begginners and is similar with the way i have worked in ms access.( it's easy to create forms with bounded controls , it's more easy to create reports....)
Is this true ?
thank you.
|
|
|
|
|
It could be. You don't konw until you try.
|
|
|
|
|
The first thing I can suggest to you is to read up on the different Areas of database communication. Personally I prefer the second technology but I have put it here for you to read upon
TableAdapters[^]
ADO.NET[^]
Until you have a understanding of these I wouldn't yet approach LinQ or Entity Frameworks, that just my 2 cents on learning database communication.
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
Without knowing the details of the project, I can't answer exactly, but...
We actually abstracted the SQL interface for our in-house software, so we don't often need to actually deal directly with the SQL server, we just write the commands and then get a result. I suggest you try something like this if you don't use datasets. It'll make your life alot easier writing and maintaining the code.
If you have any queries you call frequenty, I would also suggest that you sent them up with their own functions to automatically create the SQL command. Again, it'll make maintainance much easier.
|
|
|
|
|
I suggest you to try all types of communication while you are a beginner. When you'll start professional programming then you can decide what is best for your program. I telling you to see another tools (Entity Framework) to manipulate database http://www.microsoft.com/download/en/details.aspx?id=18504[^]
Good luck.
|
|
|
|
|
In my application, I need to address multiple configuration files. This is because different people will supply a configuration file and the application should process the information inside.
The layout of each configuration file looks like this:
<section>
<subsection id="sub1" >
<item id="item 1" value="value 1" />
<item id="item 2" value="value 2" />
</subsection>
<subsection id="sub2" >
<item id="item 1" value="value 1" />
<item id="item 2" value="value 2" />
</subsection>
</section>
Is there an easy way to keep track of several .config files and can I read those using the configuration manager? Or should I write a class to read several .xml files with said format?
|
|
|
|
|
It's probably better to create a class which will isolate you from the storage mechanism in the long run as you might have to switch out the xml to a database if your users grow, or you have to add backup logic etc.
This will all depend on how you see the usage growing.
You can also use a Key/Value store like RaptorDB to store the information which is scalable.
Its the man, not the machine - Chuck Yeager
If at first you don't succeed... get a better publicist
|
|
|
|
|
Hi all...
I wrote an application in VB.NET (VS 2008) to start a process and read its output error.
The code is given below :
Private Function getProcessOutput(ByVal processName As String, ByVal args As String, ByVal processPath As String)
Dim output As String = ""
Try
Dim prc As Process = New Process 'Create object of Process.
Dim prcInfo As New ProcessStartInfo 'Create object of ProcessStartInfo
With prcInfo 'Set attributes to ProcessStartInfo object.
.FileName = processName 'processname to start
.Arguments = args 'filename is passed as argument
.CreateNoWindow = True 'Make background process
.UseShellExecute = False 'Set to false to redirect output/error.
.RedirectStandardOutput = True 'Enable output redirection
.RedirectStandardError = True 'Enable error redirection
.WorkingDirectory = processPath 'working directory where process file is stored.
End With
prc.StartInfo = prcInfo
prc.Start()
prc.BeginOutputReadLine() 'Start reading output in asynchronous way.
output = prc.StandardError.ReadToEnd() 'Read whole error.
prc.WaitForExit() 'wait for process to exit.
Catch ex as Exception
Msgbox(ex.message)
End Try
Return output 'Return output whether it is error or program output.
End Function
This function is working pretty well in Windows XP but when I am trying to run this code in Win 7, it throws an exception that file not found.
I checked process name and working directory for the file which I want to run but still it is generating same error message.
Suggest me what should I do.
Thanks.
Gagan
|
|
|
|
|
Gagan.20 wrote: it throws an exception that file not found.
rather than showing some code (which looks OK), you should have shown the value of processName (is it a full path, a relative path? anything special, maybe one of the special folders?), and the entire exception (the ToString result, not just the Message).
Anyway, if the system says "File Not Found" it means it can't find a file it needs. It could be the exe file you want to run, or one of its dependents. Look more closely.
|
|
|
|
|
I am passing cmd.exe as process name and working directory as c:\Windows\System32\
The error message is :
System.ComponentModel.Win32Exception: The system cannot find the file specified
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
All the necessary files are present and same code is working in Win XP but not in Win 7.
What to do to make this code running on Win 7?
Thanks.
Gagan
|
|
|
|
|
My best guess is you are having 32-bit/64-bit trouble. Here are some facts:
- a process can't mix 32-bit and 64-bit code, it has to be homogeneous.
- on 64-bit systems Task Manager appends a "*" on process names for processes running in 32-bit mode.
- managed code exe's built for "64bit" or "AnyCPU" will run in 64-bit mode on a 64-bit system; managed code DLL files should be built in "AnyCPU" (the default), making them work everywhere.
- Files get organized differently on 64-bit systems, 64-bit system code is stored in system32 (!!) and 32-bit code in the new sysWOW64 folder.
The easiest approach often is:
- build managed stuff for "x86" (i.e. make it execute in a 32-bit process);
- store required DLLs in WOW64 when you put them in system32 on 32-bit systems.
|
|
|
|
|
Thanks Luc for your help.
I compiled and run my code on 32-bit successfully.
But if I want to run this code on 64-bit then what should I do?
Thanks.
Gagan
|
|
|
|
|
Luc Pattyn wrote: 640bit systems
640 wow, where can i get one of those? what would the maximum addressable memory be??
|
|
|
|
|
DaveAuld wrote: 640 wow, where can i get one of those?
many places, wide stuff[^] has been researched and experimented with for decades.
DaveAuld wrote: what would the maximum addressable memory be??
gigantic wouldn't start to describe it.
|
|
|
|
|
Hey everyone,
I'm working on a project that includes product activation. We are using a TCPclient on the client application to connect to a TCPlistener on the server. 99% of the time, everything goes fine. But we have had a few clients complain that they are unable to activate. I was able to set up a debug server and have the client try activating against that. I watched the incoming connection and the issue seems to be that the client is able to connect and send data (verified by the clients log file), but the server never receives it. The stream.readbyte() function hangs until it times out.
Here's some info on the configuration:
There are two servers, a main and a backup. Both are up and communicating with most users. They listen on ports 80 and 63016. If the connection fails on port 80, it tries 63016. If the main server cannot be connected to, it tries the backup server with the same ports.
My best guess is because it's communicating on port 80 (the http protocol's port), some firewall or security program is blocking the packets because they aren't standard http traffic. It may look like malware trying to "phone home". Which would explain why the connection goes through but the data does not. The client never tries the other port because it successfully connected (I'm in the process of changing this behavior now.)
Please, if you have any ideas or things I can try, I'd be greatly appreciative. I'm at the end of my rope here.
|
|
|
|
|
it depends if the activation problem is intermittent then it is unlikely to be firewall related problem
Firewalls usually require a program to be authorised and I believe it is generally server firewalls that check the traffic content whereas PC firewalls generally tend to block access from a particular program or to a particular port
check the software type and version installed on each client PC and compare working/non working installs to see what is different
if the IP address/netmask dynamically set or could there be differences there
|
|
|
|
|
Hi all...
I am getting an error while searching records between two dates. The error message is "IErrorInfo.GetDescription failed with E_FAIL(0x80004005)."
code is :
Try
Me.listView1.Items.Clear()
Dim resultFound As Integer
DBConnection.connect() 'Code to open database.
Dim sql As String = "select * from MortgageDetails where Current_Date between '" & Convert.ToDateTime(txtDateFrom.Text) & "' and '" & Convert.ToDateTime(txtDateTo.Text) & "'"
Dim cmd As New OleDbCommand(sql, con)
Dim reader As OleDbDataReader = cmd.ExecuteReader 'Getting error on this line.
While reader.Read
Dim item As New ListViewItem(New String() {reader.GetInt32(0), reader.GetString(1), reader.GetString(2), _
reader.GetString(3), reader.GetString(4), reader.GetString(5), _
reader.GetDateTime(6), reader.GetInt32(7), reader.GetInt32(8)})
Me.listView1.Items.Add(item)
resultFound += 1
End While
reader.Close()
lblStatus.Text = resultFound & " record(s) found!"
'Me.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
Suggest me what should I do
Thanks.
Gagan
|
|
|
|
|
It's been a while since I've seen a question from you.
Stop using string concatentation to build SQL queries. Use paramterized queries instead and let the OleDbParameter objects convert the dates to the proper format for you.
OleDb Parameterized Queries[^]
|
|
|
|
|
Thanks Dave for your quick reply.
I used parameterised query to search record but still I'm getting same error
Try
me.listView1.Items.Clear()
Dim resultFound As Integer
DBConnection.connect()
Dim sql As String = "select * from MortgageDetails where Current_Date >= ? and Current_Date <= ?"
Dim cmd As New OleDbCommand(sql, con)
cmd.Parameters.AddWithValue("Current_Date", Convert.ToDateTime(txtDateFrom.Text))
cmd.Parameters.AddWithValue("Current_Date", Convert.ToDateTime(txtDateTo.Text))
Dim reader As OleDbDataReader = cmd.ExecuteReader
While reader.Read
Dim item As New ListViewItem(New String() {reader.GetInt32(0), reader.GetString(1), reader.GetString(2), _
reader.GetString(3), reader.GetString(4), reader.GetString(5), _
reader.GetDateTime(6), reader.GetInt32(7), reader.GetInt32(8)})
me.listView1.Items.Add(item)
resultFound += 1
End While
reader.Close()
lblStatus.Text = resultFound & " record(s) found!"
'Me.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
Don't know what is wrong.
Gagan
|
|
|
|
|
First, is this using an Access database??
Is this code running in a non-UI thread?
Are your reader.Get... statements matching up EXACTLY with the types returned by the database? If you try to execute a GetInt32 on a column that is actually text, this will cause serious problems.
Change your SELECT * FROM ... SQL statement to the actual column names you want returned. This will return the columns in the exact same order every time instead of relying column numbers in your Get... code. Also, you might want to use column names instead of index numbers...
|
|
|
|
|
I solved my problem.
The problem was that Current_Date is reserved keyword in current Access table and I didn't wrote it in [].
Now I wrote following code and It worked.
cmd.Parameters.AddWithValue("[Current_Date]", Date.Parse(txtDateFrom.Text))
cmd.Parameters.AddWithValue("[Current_Date]", Date.Parse(txtDateTo.Text))
BTW thanks for your help.
Gagan
|
|
|
|
|
For future reference, if you're writing an ASP.NET site or a Windows Forms app with database access from multiple threads, you don't want to use a Access database with it. Access doesn't take very well to multithreaded environments and may throw the error you posted if you do.
|
|
|
|
|
Jesus H Christ... Someone votes me a 2 for this?? Do I REALLY have to dig up the documentation behind this statement?? FINE!! Here it is:
.NET Framework Data Providers (ADO.NET)[^] It's in the second yellow "Note" box on the page.
|
|
|
|
|
Check this CodeProjectForums .com
|
|
|
|
|
This error normally occurs when you are using a column name that is reserved keyword in Access. You don't give us any info on the column names but I would suggest you try using a full SELECT statement putting square brackets around the field names. Something like this
SELECT [Field1], [Field2], [Field3] FROM YourTable WHERE [Current_Date] BETWEEN @StartDate AND @EndDate
Hope this helps.
...and I have extensive experience writing computer code, including OIC, BTW, BRB, IMHO, LMAO, ROFL, TTYL.....
|
|
|
|