|
I absolutely do not use VB, or VB.NET, my answer is based on my knowledge of the .NET framework. I suggest you look at the MSDN entries for the classes I pointed you to, they are bound to have a full example in VB.NET.
And security that isn't locked down so it can only be accessed via a stored procedure is not remotely secure
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Hi, I was wondering what you meant by "And security that isn't locked down so it can only be accessed via a stored procedure is not remotely secure"? Does that mean that stored procedures are more secure? and are they faster/give faster data retrieval results in large database applications?
|
|
|
|
|
Anonymous wrote:
Does that mean that stored procedures are more secure?
Absolutely. If your app uses plain SQL, then your user needs the right to arbitrarily execute SQL, which means that you open yourself to all sorts of attacks ( basically because the user has full access to the database ). If you use stored procedures, then give the user only the right to run a stored procedure, then they are unable to hack in a query that asks for all usernames and passwords, and instead can just run the stored procedure ( which returns true or false to a username/password combinatin passed in ).
Anonymous wrote:
are they faster/give faster data retrieval results in large database applications?
Yes, because they are precompiled ( so long as they are properly written )
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Depending on the size of the project I almost always start out using the Data Access Application Block for .NET they are free and will save you a ton of work. It is a great starting point to both learn from and get in the right habits for writing good code. In VB 6 there were a lot of public connections used however in .Net you will find a more defined seperation between the datalayer and the rest of your application.
">href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/daab-rm.asp">[">^]
Your question covers way to much to send in a message but let me try. In your case I would create a class objLogin, interface Ilogin, class dbLogin. Make the objLogin and dbLogin implement Ilogin that way they both have matching properties(this is the contract between objects) whenever you pass objLogin to dbLogin.
The application block is your database class and is very generic so whenever you create an instance of it in your dbLogin class it will create a connection object and command object the dbLogin object uses to access the database. I know this all sounds absurd but I have not written a Data Access Object in over a year now. I don't have to since it is generic and reusable I use the same one over and over. As for the rest of the objects once you get the hang of it they are easy to do.
I hope this helps point you in the right direction to find the answers you are looking for. Just remember to get the Data Access Application Blocks and hit a few articles on interfaces and you will be on your way. Oh yeah one more thing. Use Try Catch Finally in VB.net especially in your database classes or many bad things will happen to your app.
Good Luck
|
|
|
|
|
Thanks Mr KevinMac
The link u have given me was really useful.
I think i have to be working on some oops concepts before going into .net.
I used plain visual basic 6 and i found no difficulties in working with that.But when i started .net all look "Greek and Latin", and so i dont know where to start.
Am i need to use modules and classes the same way i do it vb6 and same way for forms etc..
SO all these made me really confused and i searched for articles which will give me some ideas how to begin but nothing there for begginers like me.
To be frank
"In your case I would create a class objLogin, interface Ilogin, class dbLogin. Make the objLogin and dbLogin implement Ilogin that way they both have matching properties(this is the contract between objects) whenever you pass objLogin to dbLogin.
"
I couldnt able to understand what it actually means.
So i expect a very basic level explanation, ( more like refering this from vb6 to vb.net mode)
Thank you very much mate for you helps
with regards
vimal
Help in need is the help indeed
|
|
|
|
|
I want to store xml file in a ntext datatype in sql server 2000, someone have any idea how to do this ?
By the way it's an XMLDocument who need to be stored and they are no more than 3-4k.
I have no idea on how to do that.. please help me !
I am a somehow a newbie
|
|
|
|
|
You could convert the document into a string and then store it in the database. May not be the most compact way of storing it, however.
|
|
|
|
|
XGaMeS wrote:
I want to store xml file in a ntext datatype in sql server 2000
Erm... what is XML, if it's not text ?
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
And any clues on how to conevert it and pass it as a parameters ?
I am...
|
|
|
|
|
Okay, here's a senario that may help. Create your stored procedure to handle actually commiting the data to the database
CREATE PROCEDURE InsertXMLData
{
@XMLData ntext
}
AS
INSERT INTO MyDemoTable (XMLData) VALUES (@XMLData);
GO
To use this procedure do the following:
<code>
Private Sub InsertXML(ByVal XMLData as XMLDocument)
' create a sqlconnection
Dim SQLCon as New SQLConnection("server=...")
' create a sql command
Dim SQLCon as New SQLCommand("InsertXMLData", SQLCon)
' Set the command type and add parameters
SQLCon.CommandType = CommandType.StoredProcedure
SQLCon.Parameters.Add("@XMLData", XMLData.OuterXML.ToString)
' Variable to store records added.
Dim RecordsAdded as Integer
' Execute a non-query
Try
SQLCon.Open
RecordsAdded = SQLCmd.ExecuteNonQuery
Catch sqlex as SQLException
RecordsAdded = -1
Catch ex as Exception
RecordsAdded = -1
Finally
SQLCon.Close
End Try
End Sub
</code>
You will want to make sure to research more about the System.Data.SQLClient namespace for more information on using parameters with SQL Commands.
Hope this is useful!
|
|
|
|
|
There's nothing to convert. You just open the file and read it into a string.
Dim sr As StreamReader = New StreamReader("C:\myPath\TestFile.xml")
Dim content As String
content = sr.ReadToEnd()
sr.Close()
Then you just pass the string to your SQLCommand as you would any other SQLParameter.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
*sigh* Thank you.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
I have 2 datagrid one data grid contain data and
the other one is empty.How can the selected row
insert in to the second data grid by one by one.
using with enter key or button press
|
|
|
|
|
When enter key or button is pressed, add new row to dataset:
Dim drNew As DataRow
drNew = DATASET.Tables(0).NewRow 'Create the new row
drNew.Item("FIRST") = txtFirst.Text
drNew.Item("LAST") = txtLast.Text
drNew.Item("PHONE") = txtHome.Text
DATASET.Tables(0).Rows.Add(drNew) 'Adds new row to dataset Hope this helps
Beginner in ASP.Net and VB.Net
|
|
|
|
|
Does anyone know where I could find info on the changes in the treeview control between VB6 and VB.NET?
I am trying to convert some code over and it doesn't seem that the new TreeNodes (in .NET) have a unique key (or equivalent). I don't really want have to scan the entire tree (3k item, possibly) to try to find the match.
Any ideas?
Thanks
Scott
modified 12-Jan-22 21:01pm.
|
|
|
|
|
|
Hi, I was wondering if anyone out there might have a solution to displaying multiple data fields from a dataset, in columnar form, within a listbox.
eg. FirstName LastName Address
Thank you
|
|
|
|
|
|
Hi, thanks for your reply. This code does sort the information into columns, but not horizontally. I am looking to display multiple columns, in both a listbox and combobox, populated from a database using a dataset.
eg.
FirstName LastName Phone#
Jeff Smith (555)555-5555
John Doe (555)123-4567
etc
I have tried to use the listview, but listview does not have a datasource or selected indexes, selected values etc.
Any further input would be much appreciated. Thank you.
|
|
|
|
|
Hi, thanks for your reply. This code does sort the information into columns, but not horizontally. I am looking to display multiple columns, in both a listbox and combobox, populated from a database using a dataset.
eg.
FirstName LastName Phone#
Jeff Smith (555)555-5555
John Doe (555)123-4567
etc
I have tried to use the listview, but listview does not have a datasource or selected indexes, selected values etc.
Any further input would be much appreciated. Thank you.
|
|
|
|
|
Hi, I'm new to vb.net and was wondering if there is any way to code a function in a parent class or something to handle the gotfocus and leave events for all of the controls in my form. I want to do this to reduce the code in my application. Thank you.
|
|
|
|
|
You can add multiple handlers to a single function. For example, if you have three text boxes on your form:
Private Sub MyCustomHandler(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles TextBox1.TextChanged, _
TextBox2.TextChanged, TextBox3.TextChanged
MsgBox("I changed!")
End Sub
|
|
|
|
|
Hi, thanks for your reply. I have been able to create a customer textbox control to handle the events. I added this custom control to my toolbox and it will handle the evert everytime I insert an instance of the object into the forms.Thank you for your help.
|
|
|
|
|
Hi,
im new to VB. I like to interact with an registered activex control. F2 shows the analogous event ScanReady(occurs when datafile from scanner is at the clippboard)
The tree is like:
Event ScanReady(pDobj As IDataObject)
|_
Class IDataObject:
Sub QueryGetData(pformatetc As tagFORMATETC)
|_
Type tagFORMATETC
How to implement a message shown in my form when data is avaible??
My idea is like this:
_________________________________________
Private Sub ScanReady()
Dim pDobj As IDataObject
pDobj.QueryGetData (pformatec)
Label1.Caption = "Scandata avaible"
End Sub
_________________________________________
Private Sub QueryGetData()
Dim pformatec As tagFORMATETC
End Sub
_________________________________________
Can somebody help me?
happy coding,
-mark
|
|
|
|
|
I have to print receipts receipts from my application. I print on continuous form page and the user for example selects 1000 receipts and send them to printing. What my problem is that the receipt pages have sizes other than standart A4 and in my PrintDocuments constructor i do sth like this:
Me.DefaultPageSettings.PaperSize = New PaperSize("Fatura", 200 * 100 / OneInchInMillimeters, 200 * 100 / OneInchInMillimeters)
In print preview I see the right document size but when i send the pages to printing the printer (currently OKI Microline 3320) rolls each page as size of A4, not as my receipt documents height.
Do I have to do something on printer?
|
|
|
|