you need to open the recordset with multiple columns and then to add to the list box try this
list1.additem (rs(0)&" " & rs(1) & " " & rs(2))
you need to open the recordset with multiple columns and then to add to the list box try this
list1.additem (rs(0)&" " & rs(1) & " " & rs(2))
You only need to change the connection string to access the database.
There would hardly be any changes to your VB code for MySQL.
i have added the .addnew method to look like the following but it now ads a new row with blank fields and only one field at the end.
that is because you have assigned value only for one field (copiesremaining) not for others.
You need to call AddNew or Edit method before calling Update.
do post back in case of any issues.
you can't assign an entire recordset to a textbox. You need to fetch one field of a record and display the same in the textbox.
You need to handle the ascii value of the keys on keypress event of the control.
Please pass more info , which control you are using ? how you make those cartoons ?
what is the database that you are using ?
Try to use a procedure to insert the records into the database.
Try this sample oracle code.(convert to sql server code as per your requirement)
create or replace procedure find(eno number, flag out boolean)
is
a number(2);
begin
select count(*) into a from emp where empno=eno;
if a=0 then
flag:=FALSE;
else
flag:=TRUE;
end if;
end;
/
create or replace procedure ins_emp(a number)
is
eno emp.empno%type;
fg boolean;
begin
eno:=a;
<<abc>>
find(eno,fg);
if fg=true then
dbms_output.put_line(eno||' No already exists...');
eno := eno+1;
goto abc;
else
insert into emp(empno) values(eno);
dbms_output.put_line('New empno inserted is : '||eno);
end if;
end;
/
That is not the way to work with databases. If you want to avoid gaps then just follow post #2. But that is not going to fulfill your requirement of deleted records.
Find out the max value of the field and add 1 to generate the new value.
Please post your code that you are working on. Our experts will advice you to improve the same. Don't expect the complete code.
the first one uses client side cursor.
There are different ways to connect to database.
you can either you code or components.
try using ADO or DAO.
What is the database that you are using.
you need to copy the activex component also to the system and register that using REGSVR32 command.
How much you are ready to invest for the tool ?
What happens when you call the function / event in Form_Resize event ?
Is that not getting executed ?
Relational modeling is the logical representation of the physical relation of the DB tables.
if you are ready to pay use TOAD or PLSQL DEVELOPER, the best possible tools in market.
try the following code, make changes as desired
Dim CN As New ADODB.Connection
Dim RS As ADODB.Recordset
Dim DataFile As Integer, Fl As Long, Chunks As Integer
Dim Fragment As Integer, Chunk() As Byte, i As Integer, FileName As String
Private Const ChunkSize As Integer = 16384
Private Const conChunkSize = 100
Private Sub cmdSave_Click()
CN.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=Pubs;Data Source=Test"
Dim strSQL As String
strSQL = "SELECT * FROM pub_info where pub_id = '9999'"
RS.Open strSQL, CN, adOpenForwardOnly, adLockOptimistic
RS.AddNew
SavePicture
RS.Update
Set RS = Nothing
Set RS = New Recordset
End Sub
Private Sub SavePicture()
Dim strFileNm As String
DataFile = 1
Open strFileNm For Binary Access Read As DataFile
Fl = LOF(DataFile) ' Length of data in file
If Fl = 0 Then Close DataFile: Exit Sub
Chunks = Fl \ ChunkSize
Fragment = Fl Mod ChunkSize
ReDim Chunk(Fragment)
Get DataFile, , Chunk()
RS!logo.AppendChunk Chunk()
ReDim Chunk(ChunkSize)
For i = 1 To Chunks
Get DataFile, , Chunk()
RS!logo.AppendChunk Chunk()
Next i
Close DataFile
End Sub
that has nothing to do with database connection . check your other code.
you should get correct output with your code. there is nothing wrong with it.
You can't disable the windows key.
i don't understand your logic of authentication.
How Select * from Users ensures that the user id exists and the password entered matches with that stored in DB ?
what is the source of data in the control ? is it getting populated from database ?
* is not required in delete statement. use this
strSQL = "DELETE FROM Product WHERE Expiry_Date = '" & Text1.Text & "'"
Try the following sample code.
SELECT code,substr(code,instr(code,'-',1)+1,2) from table_name;
but it will be impossible to create as many number of text boxes as number of records grows in the database
but where is the loop in your code ?
you want to create a group of textbox for each Id ?
is that crystal report or data report ?
i don't see and disadvantages.
you nee to create a table with check constraint and default values.
try this
create TABLE table1
(ID INT,
status varchar2(10) DEFAULT 'Available',
CONSTRAINT con_chk1 CHECK (status IN ('Available','Unavailable','CheckedOut')
))
the syntax that you are using is not Oracle syntax.
You need to pass more information.
What do you mean by when an exe is ended ?
There are many applications that can be finished in your time frame. Now it depends on you what you decide to develop.
you do not need an intermediate table only defining the relationship by PK and FK will do that for you. But from your post i am not use what exactly you are looking for. I think you need to pass more information.
try this sample function for the job.
Code:
Public Function NumToWord(numstr As Variant) As String
Dim newstr As String
numstr = CDec(numstr)
If numstr = 0 Then
NumToWord = "Zero"
Exit Function
End If
If numstr > 10 ^ 24 Then
NumToWord = "Number too big"
Exit Function
End If
If numstr >= 10 ^ 12 Then
newstr = NumToWord(Int(numstr / 10 ^ 12))
numstr = ((numstr / 10 ^ 12) - _
Int(numstr / 10 ^ 12)) * 10 ^ 12
If numstr = 0 Then
tempstr = tempstr & newstr & "Bilion "
Else
tempstr = tempstr & newstr & "Bilion "
End If
End If
If numstr >= 10 ^ 6 Then
newstr = NumToWord(Int(numstr / 10 ^ 6))
numstr = ((numstr / 10 ^ 6) - _
Int(numstr / 10 ^ 6)) * 10 ^ 6
If numstr = 0 Then
tempstr = tempstr & newstr & "milion "
Else
tempstr = tempstr & newstr & "milion "
End If
End If
If numstr >= 10 ^ 3 Then ' thousand
newstr = NumToWord(Int(numstr / 10 ^ 3))
numstr = ((numstr / 10 ^ 3) - Int(numstr / 10 ^ 3)) * 10 ^ 3
If numstr = 0 Then
tempstr = tempstr & newstr & "thousand "
Else
tempstr = tempstr & newstr & "thousand "
End If
End If
If numstr >= 10 ^ 2 Then
newstr = NumToWord(Int(numstr / 10 ^ 2))
numstr = ((numstr / 10 ^ 2) - Int(numstr / …
You need to work with CDO.
i didn't understand your question .
What is a forum window ?
What do you mean by update without saving ?
From your post i became a bit curious and tried to trace back my old days here.
My first post was in community introduction section here, as i was trying to post a brief intro of self ,as per the couple of stickies in that section,just to complete formalities ,before being bombarded with questions a lot via PM from oracle and VB 6 forums.
And surprisingly i have started only one other thread Thoughts of the day ,which has over whelming response from members with 1300+ posts.
That simply means i have never asked any question and always replied to others queries/doubts.
So i am going to pat myself on the back the entire evening.
comment Unload Me in your code and i hope the rest wills tart working. use Me.Hide instead of unload Me.
You need to format the date to proper format before pasing the same to database.
what is that CON in your code ?
What type of object is that ?
Are you using ADO to connect to the database ?
then you need to populate records from the source to a staging (intermediate) table before actually inserting them to your main table.
so with each load you need to truncate your table and load only the required records.