Use A IF Statement Containing Data From A Database?
Apr 23, 2012is it possible for you to use a IF Statement containing data from a database such as: if staff id = 1234 then do as follows end if
View 4 Repliesis it possible for you to use a IF Statement containing data from a database such as: if staff id = 1234 then do as follows end if
View 4 RepliesI am using the following Select Statement to retrive data from my .csv file database:
Code:
Dim comm As New OleDb.OleDbCommand("Select *, Left([Street Full Address], IIF(InStr(12,[Street Full Address],'-')>0, InStr([Street Full Address],'-')-1, Len([Street Full Address]))) as StreetFullAddress From " &
[Code].....
I am trying to retrieve information from one row that has four columns(name,company,address,phone) so that once it is displayed in 4 different textboxes, I can transfer to a word document.
View 2 RepliesI am currently writing a VB .NET application where I am trying to open 1 database, create a select statement and then post the results into another database file using Microsoft Access database 2003.
The code seems to stop executing at the statement cmdJetDB.ExecuteNonQuery()
I am using the following code:
Dim conn1 As OleDbConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data source=C:Sample.mdb")
Dim conn2 As OleDbConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data source=C:db2.mdb")
conn1.Open()
conn2.Open()
[Code]...
Question: What is it that I am not doing. I opened both connections, stated my two SQL statements, yet it is still not working. I really need to get this application working. Please Help.........
I got a system which i want to insert, delete, update the data into my database and the data from database will be display using datagrid. The below is the coding for one of my button, delete.
Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete.Click
Try
btnSearchEmpNo.Enabled = False[code].....
Now I wanna set when user click on this button to delete a employee (for example) then the datagrid that i have in my application will not show the data of the deleted employee but in the background, the employee haven't been deleted from database.The employee only will be deleted from database when the user click on SAVE button.I know this application have to use RowState but how?
What I want to happen is that the button from my system will remove the previous data from database and then insert new data to database from text file. Im done with inserting new data. The thing is that I dont how to control or where to put the Delete Command from my code.
[Code]...
First off I am using a database code that I found on the web, which is close to what I need to do a small program for my boss. I'm in the process of tweaking it to his needs, and also in the process of trying to figure out the code. I am having a hard time trying to get one aspect working which is a COUNT of all jobs employees have been to. My Access database is as follows:[code...]
The assigned Jobs column should basically load the number of rows (Assigned Jobs) under each persons unique ID number from the Call Out Details Table, while the rest of the info is pulled in from the Employees Detail Table.
I am currently trying to develop a program, for personal use, that will monitor the lending of items of music equipments to friends and family etc. And, for my program, I have a requirement, which is the ability to search a relational database, for items loaned, through my program, based on criteria entered in a set of text boxes located upon the program's form. I have already set up the form, and have searched the Internet high and low, to no avail (probably didn't look hard enough).e,I would also like to make another request... if possible I would like to achieve this task with use of the 'LIKE' statement, so that I don't have to input the criteria in full, when I wish to search the database.
The database that I am using is a standard Microsoft Office Access database, saved in a '.mdf' format, and the database comprises of three tables; LoanTbl (which specifies the loan details), EquipTbl (which contains information about the equipment loaned) and a LinkTbl (which forms the relationship between these former two tables) - the reason for the LinkTbl, even though it may seem unnecessary, is because the data has undergone 'normalisation', so that it is stored in the most efficient way possible.
Also, whilst I am on the point of linking together my program and database, does anyone also possibly have any ideas as to ways in which to add data to this relational database; I do have coding for this, however, it only applies to a stand-alone table, whereas there are relationships between my tables.
The problem I'm having is that I cant get get the SQL statement to show all the tables within the database.
The code im using is as follows:
Imports System.Data.OleDb
Public Class frmtables
Dim objconnect As OleDbConnection
[Code].....
Is it possible to check to see if the text in a textbox is present in a table/database and then display the corresponding data.
View 2 RepliesI currently have a problem attepting to update a record within my database. I have a webpage that displays in text boxes a users details, these details are taken from the session upon login. The aim is to update the details when the user overwrites the current text in the text boxes.I have a function that runs when the user clicks the 'Save Details' button and it appears to work, as i have tested for number of rows affected and it outputs 1. However,when checking the database, the record has not been updated and I am unsure as to why.I've have checked the SQL statement that is being processed by displaying it as a label and it looks as so:
UPDATE [users]
SET [email] = @email,
[firstname] = @firstname,
[code].....
I have the following code:[code]When I run it, looking at the debugger everything looks okay but when I check the database table it is supposed to be inserting into - the column values (for occupantnum) haven't changed - they are all still null! Not sure if this is related, but note that I've now updated j to explicitly be an integer. I noticed while debugging that wResident.occupantnum was appearing as Type "Integer?" - but this doesn't seem to have made any difference - when I rerun it it still says Type "Integer?"
View 4 RepliesI am using a MS Access database as the backend of my VB.NET application. I am entering users details into the database using an INSERT INTO statement:
cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & config("DatabasePath") & ";")
cn.Open()cmd = New OleDbCommand("INSERT INTO blah blah blah...", cn)
dr = cmd.ExecuteReader
[Code]...
database - Checking if INSERT INTO statement was successful
View 11 RepliesI am trying to execute a command that inserts a row but I keep getting the error "Database error Syntax error in INSERT INTO statement." What am I doing incorrectly? I know for Ole Db refers to the parameters by sequence and I've done in the correct sequence. I left out the ID since it is auto generated could that be causing a problem?
[Code]...
I have an access database that I am writing a SQL query to insert data from my datagrid into a table that I created.I get an error that I have tracked down to field types that I have created as a DOUBLE. Here is my SQL Query for creating the table -
[code]
("CREATE TABLE [SSR Shts_" & FullName & "]([ID] AUTOINCREMENT,[Division] Text(255),[Bid Reference] Text(255)," & _
[code].....
I thought this would have been quite common but can't find anything on this. I'm trying to query columns that have spaces immbedded within them. For the life of me I don't see a way of selecting them when I'm trying to assign them to an alias when creating an anonymous type result. [code]...
View 1 RepliesI am using the following SQL statement to retrieve information from an access 2003 database but this command keeps stripping out the proceeding 0 from the number of the month. The variable is called TBookingsDateFulldate
Dim sqlQuery As String = String.Format("SELECT [ID], [Date], [Zone], [Year], [Subject], [Teacher], [LessionID]" & _
" FROM tblBookings" & _
" WHERE (((tblBookings.[Date])={0})" & _
" AND ((tblBookings.[Zone])='{1}')" & _
" AND ((tblBookings.[Active])=0)" & _
" AND ((tblBookings.[LessionID])='{2}'));", TBookingsDateFull, TBookingZone, TBookingsTimes(B, 0))
my simple update statement is not working on my database software with .mdbCompanyDa.Update(CompanyDs, "DisplaycenterData")it works but only in cache, when i restart my application the record is not updated.i solved my problem with some informal steps. i m attaching vb projects zip file, plz open coding for update button and Help me with simple coding.yes one important thing i need help and suggestion for is that in that project and forms are working nice, but with form i m facing problems, specially i cant update new added data/record, it returns error enven i follwed very same coding patterns and formate as i used in other forms in this project, i tried again and again but faild to solve the problem, i also changed table name and fields in database table but it still not working, and coding of other forms is working nice and 's update coding is not working.(update coding for company and book entry form is working and it is not working with purchase5 form, plz help to solve the problem)plz help me with simple coding and removing above mentioned error.to move between all three forms plz click related button at bottom of each form.
View 4 RepliesHow will I insert the output of my DataGridView to another table in the database? I have 4 Columns. The First and Second Columns are Check Boxes. The Third is The Stockholder Code. The Forth is The Stockholder Name. What I want to happen is, my selected records(The Stockholder Code, The Stockholder Name ) via check boxes will be inserted in my database.
Here's what I've done so far:
Try
For Each row As DataGridViewRow In DataGridView1.Rows
Dim cell As DataGridViewCheckBoxCell = CType(row.Cells("checkboxchild"), DataGridViewCheckBoxCell)
[Code].....
I have an Oracle database (external app) that contains a number of tables that I need to get data from, however I also have an SQL database that contains a number of tables that my app is using.
e.g. Oracle Table name PD_112
Structure:
ID DISP_ID1 52 83 5
e.g. SQL Table name DispTbl
[Code].....
con.Open()
sql = "select * from songs"
da = New OleDb.OleDbDataAdapter(sql, con)
[code]...
it says syntax error in INSERT INTO
Is there a way to include a person's logged in user name in an insert statement? Like, how could I detect which user is signed in, and then insert that username into my table in my database?
View 12 RepliesI am wondering how to use the keyword replace in VB.NET SQL statement and I am using MS Access 2007 Replace(CallNumber, CHR(32), CHR(13)+CHR(10)) SQL statement I am using within my connection string is: SELECT title, callnumber, location FROM CARD_CATALOG
View 2 Replies[Code]...
how can get the name of the table that = to the name of the combobox1 when i select it.
[Code]...
I have a table that has a "date" column and an "amount" column. I also have a form with two DateTimePickers ("dtp1" and "dtp2"), a button and a label. The label should show the total amount calculated from the rows whose "date" value is between the dates picked by the user with the DateTimePicker controls.
I keep getting an error with my SQL statement, and I don't know what to try. My code is as follows:
Private Sub getData(ByRef total As Double)
Dim connection As OleDbConnection
connection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\proyectogestion.mdb")
[Code]....
I will try and explain my problem as simply as I can
I have an Oracle database (external app) that contains a number of tables that I need to get data from, however I also have an SQL database that contains a number of tables that my app is using.
e.g. Oracle Table name PD_112
Structure:
CODE:
What I want to do is get all the data from the Oracle table to display in a list control however I want the values in the DISP_ID column of the Oracle table to be change to the corrosponding DESC values from the DispTbl e.g. 5 from the Oracle table would display Piping instead of 5.
I know how to do this if both the tables where in one database system e.g. Oracle or SQL, however I am not sure the best why to do this when the tables are in 2 different data sources.
Below is the code for doing this in the same datasource:
Code:
I am using VB.Net 2005, just for info
I have an Oracle database (external app) that contains a number of tables that I need to get data from, however I also have an SQL database that contains a number of tables that my app is using.
e.g. Oracle Table name PD_112
Structure:
ID DISP_ID
1 5
2 8
3 5
[code]....
I am wondering how to have more than one SQL select statement inside my window formapplication that will control the data flow, as i am a newbie in visual basic.net 2005. This is because I am working on a Alarm Application Notifier which will alert the guard on duty as well as inform him the alarm location. The guard's computer screen will be showing the premises and the button will blink at that location where the alarm is. So if the alarm is at block A for example, the guard screen will show block A button blinking.I have already done the first part but i am STUCK at the rest as to how am i going to seperate the conditions for the 3rd to 4th building .The bottom is for the first building code. The data is from the sql database.
Imports System.Data.SqlClient
Imports System.data
Imports System.Drawing.Image
[code].....
I am wondering how to have more than one SQL select statement inside my window form application that will control the data flow, as i am a newbie in visual basic.net 2005. This is because I am working on a Alarm Application Notifier which will alert the guard on duty as well as inform him the alarm location. The guard's computer screen will be showing the premises and the button will blink at that location where the alarm is.So if the alarm is at block A for example, the guard screen will show block A button blinking.
I have already done the first part but i am STUCK at the rest as to how am i going to seperate the conditions for the 3rd to 4th building The bottom is for the first building code. The data is from the sql database.
[Code]...