|
I am using VB.Net 2005 and ODBC connection to connect with SQL 2000. I can retrieve data using stored procedure ,if it has no parameter.
Now I want to pass parameter How to do that?
|
|
|
|
|
Use the SqlParameter[^] class. Create an instance of this class, configure it and add it to the Parameters collection of your SqlCommand object before executing the query.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
I m getting error like: procedure expects parameter which is not supplied
|
|
|
|
|
Did you actually follow my instructions?
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Forget using all the ODBC classes and start using the Sql classes (System.Data.SqlClient namespace) instead. The ODBC classes are "generic" and don't take advantage of any of the performance enhancements available when using the native Sql classes.
|
|
|
|
|
My problem is: If i make .exe of my project and install it on another PC then it should take the default SQL server name. If I use SQl class(that is what i m using now) then I have to hardcode my connection string
So i want to use ODBC.
|
|
|
|
|
What are you talking about? You don't hard-code connection strings in your application. You store them in a config file or the registry. There's no reason to be using a generic ODBC connection if your database is SQL Server.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Oh..I m new to programming..
I used configuration file. But I m scared that if by mistake any user makes any changes in that file then my application will not run. Isn't it riskey??
Is this way followed by professionals?
One more question, what is the advantage of ODBC then?
|
|
|
|
|
Master Mind`z wrote: I used configuration file. But I m scared that if by mistake any user makes any changes in that file then my application will not run. Isn't it riskey??
Is this way followed by professionals?
If you are developing a commercial software product, it should have a EULA[^] defined which details the liability limitations for your company if faults occur. Typically, this would state that the end user would be held liable for any problems that arise as a result of improper use of the software. This is something that your management should have put in place, so check with your boss. If you want to store sensitive information in the configuration file you could consider encrypting it, but this causes other problems i.e. where to store the encryption key.
Master Mind`z wrote: what is the advantage of ODBC then?
The advantage of ODBC is its ubiquity. You can use a standard syntax to connect to a wide variety of data sources. This comes at the expense of performance. The generic nature of ODBC means it cannot be optimized for particular providers. This is why you should use the .NET SQL Server provider over ODBC when connecting to a SQL Server database.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Thank you so much for the help.
I was using SQl class only but because of this doubt i wanted to switch to ODBC.
Thanks once again!!
|
|
|
|
|
Can anyone please assist me with tutorials or links to sites that can assist me to learn VB.Net faster. I have been using VB 6.0 all along and, thanks to this forum, I understand it's now a dead language.
|
|
|
|
|
hi
i Suggest you buy a Book "Introduction to Vb.net", www.murach.com. Articles or Tutorials covers only certain parts of Vb.net, but if you have a book, it will take you to all the changes you need to know in order to upgrade your Skills. ok, i have a site where you can download a e-book for free , still you must buy a book
http://www.ebooknetworking.com
hope it helps
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
|
Hai,
I had done one Address Management program in Vb.Net 2005 and Ms-access 2000.
The database consists of only one table with 5000 records in fifteen fields.
I had given one search option to retrive the required data from database.
I didn't use any algorithm in the program.
Simply i had used select query for finding the record.
So that i causes time delay to retrive the record from the database.
I think if i use any Search alogrithm in my program,it will reduce the time delay.
If my idea is correct,please suggest me which alogorithm i can use and how can i implement it my program.
Regards,
G.Manivannan M.Sc.,[IT],
Software Programmer (VBA),
AKUVA Infotech, Bangalore.
|
|
|
|
|
Hi,
Your Idea is right, searching alorithms certainly reduces searching time.
If your data is sorted then you may try to implement the Binary Searh technique.
For more information regarding binary search technique, you may visit the followin link:
http://en.wikipedia.org/wiki/Binary_search[^]
I hope this helps.
Regards,
John Adams
ComponentOne LLC
|
|
|
|
|
|
How do I automatic move the X & Y to create a ellipse function as
below, DrawCircle?
Or there any sample source code out there?
I want it move down by user input. How can I achieve this? Thanks.
Imports System<br />
Imports System.Drawing<br />
<br />
Public Class circle<br />
<br />
Private Sub circle_Load(ByVal sender As System.Object, ByVal e As<br />
System.EventArgs) Handles MyBase.Load<br />
<br />
End Sub<br />
<br />
Private Sub mainTab_Paint(ByVal sender As Object, ByVal e As<br />
System.Windows.Forms.PaintEventArgs) Handles Me.Paint<br />
Dim myPen As New<br />
System.Drawing.Pen(System.Drawing.Color.Black)<br />
myPen.DashStyle = Drawing.Drawing2D.DashStyle.Solid<br />
<br />
Dim widthPen As Integer = 10<br />
myPen.Width = widthPen<br />
<br />
Dim x1 As Integer = 10<br />
Dim y1 As Integer = 20<br />
Dim y2 As Integer = 70<br />
e.Graphics.DrawLine(myPen, x1, y1, x1, y2)<br />
<br />
x1 = x1 + 25 + widthPen<br />
e.Graphics.DrawLine(myPen, x1, y1, x1, y2)<br />
<br />
myPen.Dispose()<br />
End Sub<br />
<br />
Private Sub DrawCircle(ByVal sender As Object, ByVal e As<br />
System.Windows.Forms.PaintEventArgs) Handles Me.Paint<br />
<br />
' Create pen.:rolleyes:<br />
Dim redBrush As New SolidBrush(Color.Red)<br />
<br />
' Create location and size of ellipse.<br />
Dim x As Integer = 75<br />
Dim y As Integer = 25<br />
Dim width As Integer = 75<br />
Dim height As Integer = 50<br />
<br />
' Draw ellipse to screen.<br />
e.Graphics.FillEllipse(redBrush, x, y, width, height)<br />
<br />
End Sub<br />
<br />
End Class<br />
|
|
|
|
|
Well, first, you have to two methods handling the Paint event. I'm not sure what that will do for you other than confuse people who look at the code.
Second, you have no facility in your code to change the coordinates of the circle. You hard code them into the drawing code (x, y, width, height). You have to store the coordinates outside the painting code, add code to change those coordinates and invalidate the form to force a paint event.
|
|
|
|
|
I posted this question the otehr day and Dave Kreskowia has given me some great help, but I'm afriad I need more. It is hard me to read as I have a eye sight problem.
I've added Microsoft Shell Controls and Automation, then Imported shell32 namespace.
I wrote a test code to view the application windows that are currently running as follows:
Dim shlApplications As Shell
Dim obj As Object
shlApplications = New Shell
For Each obj In shlApplications.Windows
MsgBox(obj.GetHashCode.ToString)
Next
The only problem is that it is not returning the name of the application(s) that are running.
Can you help please?
Thanks
Graeme Guildford
I am always greteful for any help!
I am always greteful for any help!
|
|
|
|
|
Hi,
I am not familiar with the Microsoft Shell Control and Automation but...
why do you display obj.GetHashCode? I expect that to be a silly number, not a Windows title.
Isn't there a more appropriate property such as obj.Text or obj.Title?
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Sorry Luc
it was meant to be obj.ToString which is the only appropriate property to use.
I am always greteful for any help!
|
|
|
|
|
OK.
Maybe you want to have a look at the System.Diagnostics.Process class.
It has a static GetProcesses() which returns all the running processes.
For each of them, you can inspect:
- the MainWindowTitle property;
- the StartInfo property, which holds many things, such as FileName, Arguments (=cmd line),...
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Thanks Luc
I have written a small utility using the System.Diagnostic.Process class. The only problem is that Windows Exploerer is only listed as exporer.exe in the processes list and hwen I have Windows Explorer open and pointing to a folder/directory for eg H:\ it still only displays exploere.exe even though there might be a number of instances of Windows Exploere opened.
Dave Kreskowia suggested that I use the Shell.Application COM object by adding the Shell32.dll (Microsoft Shell Controls and Automation) refrence to my project. This is where I need help, as I've added this reference and imported the namespace, but have problems with finding the correct information.
Thanks
Graeme
I am always greteful for any help!
|
|
|
|
|
This will only return the Explorer windows, not ALL windows. It returns only the windows that belong to the Explorer process.
So, you have to enumerate BOTH the Processes AND the Shell Windows to get what you've described.
|
|
|
|
|
Is there any easy way to convert accented characters to ASCII, such that "déjà" would become "deja"? Converting the string to an ASCII byte sequence and then back to a string via
dim st_bytes as byte()
st_bytes = System.Text.Encoding.ASCII.GetBytes(st)
st = System.Text.Encoding.ASCII.GetString(st_bytes)
yields "d?j?". I could probably build a mapping table using culture-sensitive comparisons (if character+"b" sorts between that "ea" and "ec", that character must be some sort of "e") but that seems rather hokey.
|
|
|
|