choudhuryshouvi 33 Posting Pro

i have a database called "BILLING_SYSTEM" in sql server 7.0 and I'm using sql server authentication mode to connect to the database with my username "BS" and password "BS".

where my front-end is a VB6.0 application.

now I want to create this security login "BS/BS" from vb6.0 code without opening the enterprise manager console.

so how can I accomplish that?
or is there any T-SQL command for creating users?

any help on this would be highly appreciated. I have already searched in google for many time and nothing got yet. if somebody has any link to any related resources that becomes helpful too.

help plz...........its urgent...

regards
Shouvik

choudhuryshouvi 33 Posting Pro

you are welcome and don't forget to come back with your feedback.

choudhuryshouvi 33 Posting Pro

so you need to write some sample programs for demonstration and want to test it using the compilers running from vb.

well for this purpose actually there is no need to import those compilers in vb. just compile those programs using corresponding compilers in a c++ or java editor and then paste the sample code within your vb application.

choudhuryshouvi 33 Posting Pro

to set password for your access database(from ms-access) :-

Tools->Security->Set Database Password

to configure the ADODC control :-
right click (on control)>-properties-> In general tab select use connection string->click build->select Microsoft Jet 4.0 OLEDB provider->next->click ... to locate ur db->now uncheck blank password and mention ur db pwd->username always be "Admin"->click Test Connection to confirm.

now go to Authentication tab ->mention "Admin" as username and pwd->go to recordsource tab->select adcmdtable from commandtype dropdown list.
now u can select ur desire table.

choudhuryshouvi 33 Posting Pro

use TREEVIEW control for this purpose.

choudhuryshouvi 33 Posting Pro

can you please suggest other good VB websites and/or books?

you can refer these four sites (really great and intended to beginner programmers) :-

http://www.planet-source-code.com/
http://www.vbexplorer.com
http://www.vbcode.com
http://www.a1vbcode.com

and from the coding respect give me two days. i'll attach the code here.
till then bye.

regards
Shouvik

choudhuryshouvi 33 Posting Pro
Dim gcn As New ADODB.Connection

gcn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=<your access database path>;Persist Security Info=False"
gcn.Open
gcn.Execute "update <your table name> set <field name> = <value> where <criteria expression>"

is this enough?

choudhuryshouvi 33 Posting Pro

check your other thread.
i have already been replied.

regards
Shouvik

choudhuryshouvi 33 Posting Pro

use anyone of the followings :-

if rsord.state=adstateopen then rsord.close
rsord.open "select * from order",cnnord,1,2
rsord.addnew
rsord!orderid=txtoid.Text
rsord!DateOrdered=txtod.Text
rsord!CustomerId=txtcid.Text
rsord!QuatityOrdered=txtqo.Text
rsord!ProductTitle=txtPt.Text
rsord!PurchasedUnitPrice=txtpup.Text
rsord.update
if rsord.state=adstateopen then rsord.close
set rsord=nothing

OR

INSERT ORDER (OrderId,DateOrdered,CustomerId,QuatityOrdered,ProductTitle,PurchasedUnitPrice) VALUES(txtoid.Text,FORMAT(txtod.Text,"dd-MMM-yyyy"),txtcid.Text,VAL(txtqo.Text),txtPt.Text,
VAL(txtpup.Text))

hope this helps.

regards
Shouvik

choudhuryshouvi 33 Posting Pro

why do you need to do that?

choudhuryshouvi 33 Posting Pro

Dim TaskID As Long
TaskID = Shell(App.Path \ CAIsetup.exe, vbNormalFocus)

=====================

what extension shall i used???

there is no problem with the extension. your setup package is of course an self-executable file and like other exes' it also has an extension .exe . there is a mistake in your syntax.
try this out.

Shell(App.Path & "\CAIsetup.exe", vbNormalFocus)

else you can use an windows api function to execute this.

API Implementation :-
declare this api function at general section into your form :-
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

and this is your code :-
ShellExecute Me.hwnd, "Open",App.Path & "\CAIsetup.exe" , vbnullstring, vbnullstring, vbNormalFocus


think this helps.

regards
Shouvik

hawisme000 commented: thx again n again!! +1
choudhuryshouvi 33 Posting Pro

Hello,

I have a combobox on my form that I need to be populated with data from a table in MS Access. I am new to coding in Visual c# and would appreciate any help I can get with this.

Thanks in advance,

SubProf

Though this is not the right forum to reply but probably the following code should your answer. Follow it.

using system.data

oledb.oldedbconnection con;
string sql;
dataset ds=new dataset();
oledb.oledbDataAdaptar da;
int maxrows=0,i=0;

con=new oledb.oldedbconnection();
con.connectionstring="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\STUDENT.MDB;Persist Security Info=False";
con.open();

sql="select name from information order by rollno";
da=new oledb.oledbDataAdaptar(sql,con);
da.fill(ds,"Information");

maxrows=ds.tables("Information").Rows.Count();

dropdownlist1.items.clear

for(;i<=maxrows-1;i++)
{
  dropdownlist1.items.add ds.tables("Information").Rows(i).Item("Name");
}

regards
Shouvik

choudhuryshouvi 33 Posting Pro

you don't need to get the ascii code of TAB to trap the key. just put your code inside the VALIDATE or LOSTFOCUS event of ur textbox. whenever you press the tab key the code will be automatically fired.

choudhuryshouvi 33 Posting Pro

as debasisdas said,

dim ctlcontrol as object
dim fn as string,fsize as integer

fn="comic sans ms"
fsize=10

on error goto font_mistake

for each ctlcontrol in form1.controls
   ctlcontrol.font=fn
   ctlcontrol.fontsize=fsize
next

exit sub

font_mistake:
   err.clear
   resume next

hope u'll grab some idea.

regards
Shouvik

choudhuryshouvi 33 Posting Pro

use vbcrlf or chr(10)

choudhuryshouvi 33 Posting Pro

ok i can name a few components that u require to accomplish your job. and they are :-

1. Lernout & Hauspie TrueVoice American English TTS Engine
2. Microsoft Agent Character Editor
3. Microsoft Speech Recognition Engine 4.0 (English)

and u also need some narrator characters like PEEDY, ROBBY, GENIE, MARLIN,etc.

just go to THIS LINK (forget the above one) and u will find everything out there.
and u will find some sample codes also.

regards
Shouvik

choudhuryshouvi 33 Posting Pro

so looks like another post with same query.

what happened with my previous reply?
hv u not satisfied?
or want something more???

choudhuryshouvi 33 Posting Pro

The point is that when I'm trying to open this program (executable version) in another program with no Visual Basic installed, it doesn't work; I have the "ActiveX component can't create object" error.

each and every error in visual basic 6 compilation has a distinct cause/meaning for it.
the above error means "your application is trying to load an activex component that is not registered in the target machine (where vb6 is not installed) or it doesn't exist at all. in this case you can try one of the following remedies to get a perfect solution without changing a single bit of your code.

1. to open the common dialog box vb6 ships with an .ocx file named "comdlg32.ocx". it resides in your os' system directory. if u r using win9.x the sys dir is "system" or if u use nt based windows such as winxp your sys dir is "system32". navigate to that folder and there u will find a .ocx file named "comdlg32.ocx".
copy that file and install it into the target mahine where vb6 is not installed by just copy-paste it into its system dir.
then go to start->run and pass the following command to register the component :-
regsvr32 comdlg32.ocx
hit enter. you will notice a confirmation message. after this just go and run your application. you will never face any nasty error message.

OR,
'''''''''''THE SIMPLEST & MOST RECOMMENDED SOLUTION''''''''''''''''''''
2. to get rid of the above …

choudhuryshouvi 33 Posting Pro

try this code. hope this will help you.........

Dim db As Database
Dim rs As Recordset
Dim tot As Double

Set db = OpenDatabase(App.Path & "\rate.mdb")
Set rs = db.OpenRecordset("report", dbOpenTable)

tot = 0

If rs.RecordCount > 0 Then
    rs.MoveFirst
    While Not rs.EOF()
        tot = tot + rs!basic_pay
        rs.MoveNext
    Wend
End If

Text1.Text = tot
choudhuryshouvi 33 Posting Pro

you need to use microsoft agent control/editor and voice recognition engine components. these should be installed as add-ons onto your target machine. the first one is used for sending & displaying diff. characters/agents to show diff. custom msgs and the later on is used to make the agents capable to talk.

you can download these components from Microsoft's official download centre

its totaly free.

regards
shouvik

choudhuryshouvi 33 Posting Pro

thanks for all replies.
if you really got ur answer then mark this thread solved.

regards
Shouvik

choudhuryshouvi 33 Posting Pro

use order by clause in your sql.

like ,
select * from <table name> order by <field name>

choudhuryshouvi 33 Posting Pro

visual basic 6 smoothly runs in windows 98,win2000,winme and win xp operating systems.

so it should run in sp1 also.
though i have not tried sp1 yet but i hv implemented a project sp2 which is higher than sp1. it ran without a single piece of problem.

regards
Shouvik

choudhuryshouvi 33 Posting Pro

well that might be not an easy solution.
you need to implement control arrays to accomplish this task.

the way you are trying to solve out this prob you need to create textboxes dynamically on ur form based on number of records returned by your recordset.

do search in google on control arrays with vb6.

choudhuryshouvi 33 Posting Pro

select * from <table name> where id = " & <pass ur id here>

to display in text box :-
text1.text = rs!name

where rs is a recordset object

choudhuryshouvi 33 Posting Pro

where i attach my file here?
because im new here,thank u for reminding me.

click the go to advanced button near the post box
there you will find a paper clip sign.
click it to display the attachment windows. then locate ur file and press upload to complete the task.

choudhuryshouvi 33 Posting Pro

when u have doubts in ur mind then throughly describe it in ur post. also this forum gives you the facility to upload ur files if you wish to do so others can view it. but do not ask anyone to solve out ur problem privately.
we are all here to give u suggestions and but the rest of it you have to solve. no one will help u until you show what hv u done so far to solve ur probs.

so act now in proper direction..........

choudhuryshouvi 33 Posting Pro

you can make a trick on this.

just unload the form and show it again.
like

unload frmAdd
frmadd.show

then fire the code inside the button responsible for displaying the report.

choudhuryshouvi 33 Posting Pro

ok i took the customer table and this is the code for it.
focus on the bolded part.

Dim db As Database
Dim rs As Recordset
Dim li As ListItem

Set db = OpenDatabase(App.Path & "\asa.mdb")
Set rs = db.OpenRecordset("customer", dbOpenTable)

[B]If rs.RecordCount > 0 Then
    rs.MoveFirst
    While Not rs.EOF()
        With lvcustomers
            Set li = .ListItems.Add(, , (rs!cus_num))
            li.SubItems(1) = IIf(IsNull(rs!cus_name), "", rs!cus_name)
            li.SubItems(2) = IIf(IsNull(rs!cus_tel), "", rs!cus_tel)
            li.SubItems(3) = IIf(IsNull(rs!cus_add), "", rs!cus_add)
        End With
        rs.MoveNext
    Wend
End If[/B]

also see the snapshot.

regards
Shouvik

choudhuryshouvi 33 Posting Pro

ok try this code.

Dim fl As Long, confirm As Integer, str As String, FNum As Integer

fl = FileLen("c:\aa.txt")
If fl = 0 Then
    MsgBox "zero length file."
Else
    confirm = MsgBox("Do you wish to print?", vbYesNo)
    If confirm = vbYes Then
        Text1.Text = ""
        FNum = FreeFile
        Open "c:\aa.txt" For Input As #1
            str = Input(LOF(FNum), #FNum)
        Close #FNum
        Text1.Text = str
        Printer.Print Text1.Text
        Printer.EndDoc
        MsgBox "Control passed to printer. Please verify.", vbInformation, "Print"
        End
    Else
        Exit Sub
    End If
End If

replace the Red marked portion with the physical location of the file that you wish to check and print.

plz let me know if this helps you to solve out ur problem.

regards
Shouvik

choudhuryshouvi 33 Posting Pro

Hi

I am COMPUTER SCIENCE STUDENT.

I created thesis project with a report using VB6 datareport and Access2000. The report works fine on my machine, but when i presented this to my instructor an error "Invalid Data Source" occurs when I installed the application on other machines without visual basic system. My instructor give me another chance to solve this problem and submit it again. Anyone can help me to solve this?

first of all you need to bundle your project into a self-executable setup package before you can use it in a machine having no copy of visual basic installed. you can use the Package and Deployment wizard to accomplish this task. Visit this thread if you don't know how to create a setup package :-
Problem in running application on another computer
scroll down and find reply #8. the whole thing was described there.

and for your report, this is not a problem of your program. its a lack of vb6 itself to find the physical location of the database if its target is changed. when that nasty error dialog shows up just replace the location with your current physical location in the target machine(where u have installed the application) of your database. you have to do this once. click ok to save and then everything will run like butter.

regards
Shouvik

choudhuryshouvi 33 Posting Pro

just make the code looks like this :-

If KeyCode = vbKeyF1 Then
search_click
delete_click
If KeyCode = vbKeyF2 Then
delete_click
End If

choudhuryshouvi 33 Posting Pro

well you can use the following syntax to implement option buttons :-

if option1.value=true then
''code your statements
elseif option2.value=true then
''code your statements
end if

an option button has two state to judge its selection and it has a value method which is a boolean type parameter.

if the option is selected then it returns true else returns false. now based on selection you can store caption of the same option button into ur database as answer supplied by a student like rs!answer=option1.caption

hope u'll get some from this.

i just tried to give u some basics about option button. now according to ur post its been a long story in order to solve out ur entire question. may it takes some time. if i got it then i'll reply u.

ok....

regards
Shouvik

choudhuryshouvi 33 Posting Pro
choudhuryshouvi 33 Posting Pro

why r u using foxpro?
instead of it use access database to store data.
as it is more reliable,fast and easy.

also use ADO technology rather than using DAO.
coz it is most advanced and more powerful.

Check out this beginner tutorial on connecting with access databases using ADO

regards
Shouvik

choudhuryshouvi 33 Posting Pro

you meant you want to check whether the file has any content in it or not? if it is a zero length file then you wish to abort the print job else you want to give confirmation?

is that so or anything else?
plz buddy make your post more clear so it can be understandable by those people who will afford to make replies against your post.

ok......
hv a nice day

choudhuryshouvi 33 Posting Pro

ok..... here is the sample
try it and get back with your result

Dim i As Integer, no As Variant, sum As Double, avg As Double, confirm As Integer

sum = 0
avg = 0

For i = 1 To 12 Step 1
begin:
    no = InputBox("Enter sales figure for Month " & i & " :", "Count Avg Sales")
    If Trim(no) <> "" Then
        If IsNumeric(Trim(no)) Then
            sum = sum + no
        Else
            confirm = MsgBox("Not a number." & vbCrLf & "Would you like to retry?", vbQuestion + vbYesNo, _
                    "Type Mismatch")
            If confirm = vbNo Then
                Exit For
            Else
                GoTo begin
            End If
        End If
    Else
        confirm = MsgBox("The figure cannot be null." & vbCrLf & "Would you like to retry?", _
                vbQuestion + vbYesNo, "NULL Input")
        If confirm = vbNo Then
            Exit For
        Else
            GoTo begin
        End If
    End If
Next i

avg = sum / 12
MsgBox "The Avg. sales is " & avg

regards
Shouvik

choudhuryshouvi 33 Posting Pro
choudhuryshouvi 33 Posting Pro

How to be sure when the file is updatable or movable from dir to other dir???

what exactly do you wish to achieve by this?

choudhuryshouvi 33 Posting Pro

you can apply various logics to solve out this.
i am giving you a simple one.

use the inputbox function to display the standard input box and prompt the user to enter a sales figure. to accept 12 values in a continuous manner apply a for...loop statement (for i=1 to 12). you can also perform some validations to check whether the value given by the user is a valid numerals or not but that is completely upto you. take a variable like "sum" and assign zero to it. then while the user enters a sales figure assign that figure to the variable sum and add it with existing value of sum. when 12 figures are accepted divide sum by 12 and store the value (which is your average) to a separate var. like "average" and finally display it.

try it and get back with ur feedback.

regards
Shouvik

choudhuryshouvi 33 Posting Pro

there is no relation of chr(5) with the error "invalid property value".

this "chr(5)"was used by me in one of my application to retrieve value from one of the tables after just replacing the ascii code of vbnewline to ",".you can skip this character. there is no need of it in your code.

do you know what is the meaning of this error msg?
if don't then listen,
vb6 compiler returns this error if any column to which you are adding data doesn't exist in the listview at all.

you must have similar number of columns in the listview the no. of times you fire this li.subitems statement before adding data.
in this command li.subitems(1), the numeral within the paranthesis refers to the column to which you are adding data. you can consider it like an array. but in this case the lbound starts from 1. if the compiler doesn't find the column at the specified index position in the listview it fetches you "invalid property value" error.
to add data into the first col of the lv you use
set li=.listitems.add(,,(<your data to be added>))
then from second to n-th no. of columns you use li.subitems(<col. index no.>)=<your data to be added>

so as much as i told u the error was in your target lv not in the code and it would never be because it was used in several forms of my application and tested many times.

so …

choudhuryshouvi 33 Posting Pro

check out this sample project.
to get the HTML report preview click Reports (from main screen), select all invoices option.
mention date range as 2-2-2008 to 2-28-2008 and click Generate to view the report.

hope this can give you some idea.

regards
Shouvik

choudhuryshouvi 33 Posting Pro

check out this sample, try it and give your feedback.

Dim str As String
Dim rs As New ADODB.Recordset
Dim li As ListItem

str = "select * from org_master order by org_id"
rs.open str, ADODB.adOpenDynamic, ADODB.adUseClient, ADODB.adLockOptimistic

lvoffice.ListItems.Clear

If rs.RecordCount > 0 Then
    rs.MoveFirst
    While Not rs.EOF()
        With lvoffice
            Set li = .ListItems.Add(, , (rs!org_id))
            li.SubItems(1) = Replace(rs!org_name, Chr(5), ", ")
            li.SubItems(2) = IIf(IsNull(rs!Description), "", Replace(rs!Description, Chr(5), ", "))
        End With
        rs.MoveNext
    Wend
End If

If rs.state = adStateOpen Then rs.Close
Set rs = Nothing

regards
Shouvik

jaasaria commented: thx 4 the help in making listview +1
choudhuryshouvi 33 Posting Pro

Hi Shouvik..
Thanks .. I tried your code but i am getting the error msg "error in creating the new record."

might the error is occurring in these lines :-

rsnew3!text1=text1.text
rsnew3!text2=text2.text

when i was rectifying your code i assumed that you have the fields named "text1" and "text2" in your table. so i wrote the code. but if you are getting the error then try this solution :-
just replace "text1" and "text2" with actual field names present in your table and make sure you are not sending any empty or null value if your fields have required constraints.

try it and know me what have you finally got.

regards
Shouvik

choudhuryshouvi 33 Posting Pro

there will be a little bit modification on your code and everything will be ok.

try this :-

Dim addnew As Boolean

addnew=true

on error goto err1

If text1.Text = "" Then
   MsgBox " enter the company name"
   text1.SetFocus
   exit sub
end if

If text2.Text = "" Then
   MsgBox " enter the company address"
   text2.SetFocus
   exit sub
end if

rsnew3.Open "select * from company", c, adOpenDynamic, adLockOptimistic
rsnew3.addnew
rsnew3!text1 = text1.Text
rsnew3!text2 = text2.Text
rsnew3.Update

if addnew=true then MsgBox " add new successful ", vbInformation, "successful"

if rsnew3.state=adstateopen then rsnew3.close
set rsnew3=nothing

exit sub

err1:
     err.clear
     addnew=false
     msgbox "error in creating the new record."
     set rsnew3=nothing
     exit sub 
End Sub

get back with your result.

regards
Shouvik

choudhuryshouvi 33 Posting Pro

it seems like your application is somehow missing .ocx file when you are trying to compile the application. place the .ocx file to your windows system directory. to find the system directory of your os goto start->run then type this :-
%systemroot%\ if ur using windows xp then system32 is your target else system is ur target.

after placing the ocx goto start->run again and type the following command :-
regsvr32 <your ocx file name>

now open your project and add the activex control again from the project->components dialog. place that on ur form

now compile the prg. it should not be any problem now.

try and give feedback

regards
Shouvik

choudhuryshouvi 33 Posting Pro

its better to use an update query instead of using the update method.

choudhuryshouvi 33 Posting Pro
choudhuryshouvi 33 Posting Pro

thank you very much too for such an honorable reply. i am feeling very proud at this time. this is all for you. i'm feeling like a charm who have been useful in helping people. thank you very much for keeping in touch.

remember one thing i am always been here for helping you people. so whenever you got any problem just remember me. this is my email id :
choudhuryshouvik@gmail.com
you can send your queries to my inbox also. i will try my level best to serve you efficient solution.

now when you got all the stuffs start learning now. when you got some knowledge then come back and we will discuss more things on this.

ok........
till then bye

and one more thing i you think that your question has been solved then please don't forget to mark this thread solved.

regards
Shouvik

choudhuryshouvi 33 Posting Pro

read this tutorial.