March 22, 2007 at 9:32 am
So using Visual Basic.net edition would make it easier to put information in to SQL? I want to take peoples first, last, Address, City, State, and Zip with a picture of them and have it save with a click of a button. Then be able to search for the person afterwards.
I have made tables before with MySQL. Now using SQL I type the syntax in the Query Analyzer to make the table. I do have a copy of Visual Basic.net. I am going to install this and Full trial version of SQL 2005. I am downloading SQL 2005 then install Visual Basic.net. Now i need some guidance on where to insert the code. But I will look at his when it all gets installed. Any pointer that I should take? Thank You for the help!!!
March 23, 2007 at 4:53 am
Well the best way would be to first create some stored procedures like:
Add a customer
create procedure dbo.spAddCustomer
@fName varchar(30),
@lName varchar(30),
@address varchar(60),
@city varchar(60),
@state varchar(2),
@zip varchar(14),
@path varchar(255)
as
begin
insert into dbo.Customers ( fName, lName, address, city, state, zip, path )
values ( @fName, @lName, @address, @city, @state, @zip, @path )
end
Search for a customer
create procedure dbo.spGetCustomer
@fName varchar(30),
@lName varchar(30)
as
begin
select fName, lName, address, city, state, zip, path
from dbo.Customers (nolock)
where fName like @fName + '%'
and lName like @lName + '%'
end
Now typically you would want to have a unique identifier for a customer like an email address or an account number so you don't retrieve information that is really not theirs. Also you would want them to give you a username and password, which would accomodate this.
To put the data in, use a SqlConnection object to open the database and then a SqlCommand object to handle the stored procedure call.
To get the data back, you can use the SqlConnection, and SqlCommand objects again and then this time also use the DataSet object in combination with the SqlDataAdapter to fill the DataSet.
You might want to start by getting this book: MICROSOFT ADO.NET STEP BY STEP by Rebecca M. Riordan, which will walk you through the basics of ADO.NET
March 23, 2007 at 5:43 am
Go ahead and store the picture in the database; define the column as varbinary(max). In your VB.Net application, using an ADO.Net dataset to query the table.
You don't say if you are planning a Windows forms app or ASP.net web app, and the process of binding it to a (windows or web) form control is a little different for each due to using different controls and the capabilities of each. But generally, it will involve converting the database column to a Byte array, then loading it into a Stream object, and loading that into the form control.
Storing the image is just the opposite. Check MSDN library for examples of how to do both processes.
Providing the user options for loading the picture into your application will follow the same pattern. If you want them to provide a file, read the file into Stream object and load that into the control. You may want them to provide image through clipboard, then it is just reading the clipboard into the Stream object then to the control. Or you may want to provide scanner capture, and again it would be referencing come Twain component and reading it into a Stream object and loading it into the control.
Hope this helps
Mark
March 23, 2007 at 7:23 am
Your best option is to find the 101 Tutorials. They even have that same sample, load pictures into a SLQ DB.
You will find much more than that.
March 23, 2007 at 7:39 am
GREAT Idea, Camilo. I had forgotten about that resource.
Here's the link for 101 Samples for Visual Basic 2005
Hope this helps
Mark
March 23, 2007 at 4:29 pm
Thank You for the help!!! I'll work off of this a see what happens. If there is anything else please post it!!!
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply