•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the VB.NET section within the Software Development category of DaniWeb, a massive community of 392,038 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,309 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our VB.NET advertiser:
Views: 669 | Replies: 6
![]() |
•
•
Join Date: Dec 2007
Posts: 52
Reputation:
Rep Power: 1
Solved Threads: 0
ok i kno wthe other thread i made was stupid but this one actually has use, first off how can i code a button to add a row to a database and make the row a yes/no so it will show as a radio button on the form and stay there, second i remember reading somewhere you can make a magnifing glass type thing but can u make a program that will magnify part of the screen u tell it and that part becomes fullscreen so you can click on it?
•
•
Join Date: Jan 2008
Posts: 14
Reputation:
Rep Power: 1
Solved Threads: 1
To add a row in the database you need to the following things:
I am sorry, but I do not know how you would achieve the magnifying glass effect, but I would try to use flash to do it.
Hope this helps
imports system.data.oledb Private mycomm As New OleDb.OleDbCommand Private myconn As New OleDb.OleDbConnection 'The following code goes under the button procedure. Dim strquery as string myconn.connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=(location of database);User Id=admin;Password=;" strquery = "INSERT INTO (put table name here) VALUES (put values here)" mycomm.connection = myconn mycomm.commandtext = strquery mycomm.executenonquery strquery="SELECT (yes/no column) FROM (table name)" mycomm.commandtext = strquery if mycomm.executescalar = yes thenradiobutton1.checked = trueelseradiobutton1.checked=falseend if
Hope this helps
•
•
Join Date: Dec 2007
Posts: 52
Reputation:
Rep Power: 1
Solved Threads: 0
im sure it would help if i knew how to incorperate it into my program, but mine is a little bit, how do i put it, i dont even know where to start figuring out how to use your code in my code. my program is just like to i guess basic or easy for your code, for example
to make my database i found it easier to use the database wizard so it added everything for me, so i dont know the full location, i could prob find it, but then i dont know the values, plus i dont understand the rest of the coding
•
•
•
•
myconn.connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=(location of database);User Id=admin;Password=;"
strquery = "INSERT INTO (put table name here) VALUES (put values here)"
•
•
Join Date: Jan 2008
Posts: 14
Reputation:
Rep Power: 1
Solved Threads: 1
•
•
•
•
im sure it would help if i knew how to incorperate it into my program, but mine is a little bit, how do i put it, i dont even know where to start figuring out how to use your code in my code. my program is just like to i guess basic or easy for your code, for example
to make my database i found it easier to use the database wizard so it added everything for me, so i dont know the full location, i could prob find it, but then i dont know the values, plus i dont understand the rest of the coding
Sorry, I sometimes get a little ahead of myself. Let me explain the code. The 'imports' statement at the top just retrieves the namespace needed for the code to work. The two following variable declarations do not have to declared privately, but they are the command, which tells the program what to do with the database, and the connection, which connects to the database. 'Strquery' is a string which will be used for SQL statements. SQL statements are used to interact with the database and can insert data, retrieve data, and can also do many other things. To get started with SQL you should look at this tutorial: http://w3schools.com/sql/default.asp. The connection is then attributed a connection string (where the program will look for the database). All you need to do is specify the location. Now the following statement is a SQL statement. It has to be fully enclosed in quotes. This SQL statement will insert a new row in your database, but it first needs to know the table name and the value(s). For example:
strquery = "INSERT INTO Persons Values ('" & textbox1.text & "','" & textbox2.text & "')Whenever you insert strings into a database using SQL statements, you must enclose it in single quotes, so in VB it is a bit different since the single quotes are for commenting. In the next line you are assining the command the connection in which it will insert the data. IMPORTANT! Sorry, but I forgot to do this in my first post, but after assiging the command to the connection, you have to open it like this: myconn.openThe next statement gives the SQL statement to use, and executes it after that. I not sure if I understand what you would like to do after, but from what I understand, you can just have an 'If...then' statement that checks the radio button according to the value entered. If you have any more questions, don't hesitate to ask!
Last edited by nowitzk : Jan 28th, 2008 at 7:14 am.
•
•
Join Date: Dec 2007
Posts: 52
Reputation:
Rep Power: 1
Solved Threads: 0
ok, somethings screwd up, i looked at my database and realized i had typed it up on the save table so to add a new class to the program i will have to add a new column, i think i will try to use the code u gave me but... do i need to
if i have an oledbdataadapter? also could i use the creat index function to make it so i can have a search box for the program?
p.s. slry it took me so long to reply, i read through the whole tutorial before i responed, also i dont know when ill be able to work on adding it to the code because ive been loaded with work that i need to do
myconn.connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=(location of database);User Id=admin;Password=;"
if i have an oledbdataadapter? also could i use the creat index function to make it so i can have a search box for the program?
p.s. slry it took me so long to reply, i read through the whole tutorial before i responed, also i dont know when ill be able to work on adding it to the code because ive been loaded with work that i need to do
•
•
Join Date: Jan 2008
Posts: 14
Reputation:
Rep Power: 1
Solved Threads: 1
•
•
•
•
ok, somethings screwd up, i looked at my database and realized i had typed it up on the save table so to add a new class to the program i will have to add a new column, i think i will try to use the code u gave me but... do i need tomyconn.connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=(location of database);User Id=admin;Password=;"
if i have an oledbdataadapter? also could i use the creat index function to make it so i can have a search box for the program?
p.s. slry it took me so long to reply, i read through the whole tutorial before i responed, also i dont know when ill be able to work on adding it to the code because ive been loaded with work that i need to do
No problem, but I am pretty sure that it will work with the oledbdataadpater and you can also use the create index function, and any SQL function for that matter.
•
•
Join Date: Dec 2007
Posts: 52
Reputation:
Rep Power: 1
Solved Threads: 0
sorry its been so long since ive posted, but i have ben really busy and still havnt worked on that program but before i did i was going to ask you, if i use the oledbdataadapter would i have to do this
or what? also with the contex index or whatever do i have to go into the oledbdataadapter and under quiries where you choose what column you want of what table would i have to add
or would i
or niether? what would i do to do the searching?
myconn.connectionstring = "oledbdataadapter"
CONTEX INDEX = Employee_IDor would i
CONTEX INDEX = Employee_ID = parameter1or niether? what would i do to do the searching?
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb VB.NET Marketplace
- host a site on a local network (Web Developers' Lounge)
- how to use Mscomm (VB.NET)
- best tutorial (Java)
- RmDir and MsChart Have Problems in XP -Pls Help (Visual Basic 4 / 5 / 6)
- Pls Hlp me with Hijackthis log file. (Viruses, Spyware and other Nasties)
Other Threads in the VB.NET Forum
- Previous Thread: Assigning Value
- Next Thread: game problem


Linear Mode