Hi
You should try posting to the database forum, my MySQL knowledge is limited but someone there should help
The MySql section is here: Web Development, Databases, MySQL
Hi
You should try posting to the database forum, my MySQL knowledge is limited but someone there should help
The MySql section is here: Web Development, Databases, MySQL
Hi
Did you try
m_con.ConnectionString = "Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\MyDB\book.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"
Hi
Is this file "live" ie are you looping through the file until something has written to the file?
In which case you will have to reload the file in each loop but ensure you only open it as read only or you will lock the file for editing and prevent it being written to.
Hi,
If you want to reseed an identity column in SQL server you would use this:
CAUTION Be Very careful before doing this
DBCC CHECKIDENT (orders, RESEED, 0)
Hi,
I think you need to get the actual RTF back then parse the rich text and strip out any RTF coding and replace the RTF new Line character with vbcrlf.
It's been a while since I looked at RTF text so I'm not 100% sure of the syntax. Here is an example though of when I cleaned up Word generated "HTML"
Function CleanHTML (byref Input as String) AS String
Dim bInTag as boolean = false
dim sChar, Tagcode, Output as string
dim i as integer
for i =1 to len(Input)
schar = mid(Input,i,1)
if not bInTag then
if schar ="<" then
binTag =true
else
Output += schar
end if
else
if schar = ">" then
bInTag = False
if Instr(TagCode, "</") <> 0 then
Output += TagCode
elseif Instr(TagCode, <B) <> 0 Then
Output += "<b>"
'etc.
end if
TagCode=""
else
Tagcode += UCASE(schar)
end if
End if
next
As I said that's roughly what I did for HTML but I'm sure you could do somethng similar for RTF.
Here is a simple example:
Form 1
Sub ShowDetials()
dim RecordID as integer
dim DT as datatable
Dim DS as new dataset
Dim DA as new OleDBDataAdapter
dim mCmd as new OleDbCommand
dim DetialsForm as new Form2
'I will assume your datagrid has row selection and the primary key of the record is in cell 0
dim Conn as new OleDbConnection(Connectionstring)
conn.open
IF MyDatagridView.SelectedRows.Count>0 then
RecordID = MyDatagridView.SelectedRows(0).Cell(0).value
mCmd.Connection = Conn
mCmd.CommandType = CommandType.Text
mCmd.Text ="SELECT * FROM MyTable WHERE(MyID =" &RecordID &")"
DA.SelectCommand = mCmd
DA.Fill(DS)
DT = DS.Tables(0)
'now for the putting stuff on to the other form...
'For speed I'll just stick evrything into a datagridview
DetailsForm.DataGridView1.Datasource = DT
DetailsForm.Show()
end if
End sub
Datasetrs and datatables are held in your computers memory they are disconnected from the database so you can update them but when you look at the database table the cahnges are not there. You must run either an update or insert query on the database such as M.Waqas Aslam has done in his example.
To break it down you should do something like this:
An alternative is to use the command builder to specify an Update or Insert command for your dataset and when you update the datatable it will run that query.
Sub RefeshData()
m_dataTable = new Datatable
m_con.Open()
m_DA = New SqlDataAdapter("select * from book", m_con)
m_DA.Fill(m_dataTable)
m_con.close() 'because dataset etc are disconnected
End sub
sub AddData(ByRef Firstname as string, byref Lastname as string)
m_con.Open()
dim mCmd as new sqlcommand()
mCmd.Connection = m_con
mCmd.CommandType = CommandType.Text
mCmd.Text ="Insert INTO book(Firstname, LastName) Values('" &Firstname &"','" &Lastname &"')"
mCmd.ExecuteNonQuery()
m_con.close()
RefreshData()
End sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
m_con.ConnectionString = "Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\book.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"
RefreshData()
End Sub
Can we see a bit more of your code?
Where are you specifying the Update commands for instance? - You will need more than one as you are updating two tables within your dataset.
Hi,
You should be able to pick up some freeware Screen scraping software to do this for you...
Hi,
You've defined ch as an oledbcommandbuilder on da1 but you have not given it a SQL Update statement or procedure to run on the update. You also haven't specified that it is the Update command for da1.
I think what you are looking for is this:
ch.GetUpdateCommand()
da1.Update(ds)
Show us your code...
Hi
This is because your datatable is held in the computers memory - it is not the database table rather a disconnected query result held there for you.
You must either run a command to update the SQL table and then refresh. Or update the Database table and then the datatable as you are doing.
The only place success comes before work is in the dictionary
As my old grandmother used to say
Home and learn
Microsoft
Programmers Heaven
These should get you started, also Wrox generally have good books on programming.
Finally, once you are up and started this forum - I learn (or re-learn forgotten,) VB.Net techniques and skills all the time on Daniweb
Glad to be of help, remember to mark as solved...
Hi,
In your decriment function code instead of having:
Form2.textbox1.text = Val(Form2.textbox1.Text - 1)
Change it to
i = i - 1
Form2.textbox1.text = i
In your retrieval SQL statement you are using an Insert Statement not a Select statement...
Also, cmd.ExecuteScalar is for running queries that return a single scalar value, it would appear you wish to return information other than the picture as well.
Once you get the picture out of the SQL statement, you will have it in the form of a byte stream so you will have to stream the data back into a picturebox or some such object.
Pritaeas,
Yes, it is allowed, the User is Database specific and the Login is Server specific. I am mapping the SQL server Login to a SQL user on the database.
Anyway figured out what happened, - a simple mistake, I modifed my code and accidently took out the part where I disconnect from the master DB and connect to my new application DB.
So I was creating the Application DB then creating the user in the master DB not the application DB hence although I deleted my application DB the code was trying to put everything into the master DB....
Hi,
I'm writing a VB.net application that runs off a SQL database. If the application can not connect to the database or the connection has not been set up I'm giving the user the option to create the database on the SQL server instance of their choice I then create the database and it's tables, dedicated user for the application to use and Stored Procedures. All this worked fine when testing yesterday including the user creation BUT for some reason, the User creation is throwing an error today. The Scripts I use to set up the user are as follows:
I run this Script on the master when logged in as an Server admin user.
CREATE LOGIN MyAppUser WITH PASSWORD ='UserPassword', DEFAULT DATABASE = MyAppDB
This sets up the SQL Login I then run the following on the actual database to add the SQL Login to the Database User list:
CREATE USER MyAppUser FOR LOGIN MyAppUser
Unfortunately, I am now getting an error telling me the user, group or role already exists in the current database but if I look in the SQL Server, I can only see the user under the Server logins not under the Application Database Users. I'm going to try removing DEFAULT DATABASE setting but I understand this then just defaults to master.
Hi
I suspect the web page you are inputting the data into is performing some sort of client side validation before enabling the submit button. So you are going to have to make your form wait until the button is enabled.
Before VB.Net we used to use Do Events but I believe the way .Net framework handles this is different now so you will have to use a Thread.Sleep call after you have inputted the data. This will block the current thread for the specified number of milliseconds.
if you wish to use third party tools, I've used KnowledgeSync from Vineyardsoft and Task Centre from Orbis
Both of these tools can be made to monitor folders for activity as well as other event fired workflows e.g. I used KnowledgeSync to chase up tickets in a help desk system via SQL and TaskCentre to create a whole annual leave request system in Sharepoint.
Hi,
It is easier if you try and break it down into steps:
This is because you are not decreasing the value of i in your decrement function, you are decreasing the textbox entry not i maybe if I illustrate below:
How are you passing in the date values? Are you using the text that you have given? or DDMMYYYY or MMDDYYYY or some other format? Can you put your actual SQL query down it should only logically return data for the second query as September is before October.
I take it you have the selection mode set to Row select?
You will need to use the SelectedRows property e.g.
Dim startingBalanceRow As DataGridViewRow = DataGridView1.SelectedRows(0)
textbox1.text = startingBalanceRow.Cells(0).value
textbox2.text = startingBalanceRow.Cells(1).value
You're only as fast as the slowest point on your connection. I take it that the URL you're sending that too is on an outside network or remote computer?
Also, without knowing what your are sending and what the URL does I couldn't say for sure there was no lag on that end - I'll assume the less you send the faster it goes.
Finally, Why send multiple SMS? Most people have smart phones nowadays that can pick up email unless you are spamming people in which case I don't want to help...
You could also try the ISNULL clause e.g.
SELECT ISNULL(MyCol, '') as MyCol From MyTable
Would return either the value in the MyCol column or an empty string if it was null
As Jim says, you need to Explicitly tell SQL Server which columns you are inserting your data into. For example, say I had a table with two columns A and B both these SQL statements are valid:
INSERT INTO MYTable (A,B) VALUES (Value1, Value2)
INSERT INTO MYTable (B,A) VALUES(Value1, Value2)
So when the DB parses the statement, it does not know which columns you wish to use unless you tell it.
Hi
It sounds like you want to create a master / details view using two datagrids? Here is an example MSDN Example although this has each one statically displayed on a form.
I think what you will have to do is create a data set with your "master" data and your "Sub" data and define a relationship between them as in the example above BUT only have one datagridview displayed and when the user clicks on it display a second grid using the results of a lookup via the relationship.
Hi
Yes because the data is not coming from an individual table you will need to run the DELETE / UPDATE / INSERT queries as a seperate query for each table.
sub UpdateHumanResource()
dim cmd as OleDbCommand
dim sSQL as string
....
con.open
sSQL ="UPDATE Academic SET FirstLevel ='" &cmbFirstLevel.Text &"', FirstAward ='" &txtFirstAward.Text &"' etc..."
cmd = new OleDBCommand
With cmd
.CommandType = CommandType.Text
.CommandText = sSQL
.Connection = con
End With
cmd.ExecuteNonQuery
sSQL ="UPDATE tblDetails ...."
cmd = new OleDBCommand
With cmd
.CommandType = CommandType.Text
.CommandText = sSQL
.Connection = con
End With
cmd.ExecuteNonQuery
end sub
Hi,
Do you mean you get a phone number and you want to display in that format?
dim MyPhoneNumber as string
....
Textbox1.Text = MyPhoneNumber.SubString(0,3) &"-" &MyPhoneNumber.SubString(3)
Or do you want to force users to enter in that format? Or Both?
In that case you need The Masked Edit Textbox
Or you will have to use A Validation Class - I never used one before though.
There is no ideal system for we are not perfect beings and therefore there will always be the haves and the have nots.
Here you go:
Project Hello World
Documentation: When the user clicks on the button a message "Hello World" appears
Open a new project and web page add a button called Button1 and a label called label1 to the page
Under the Button1 click event Code as follows:
label1.text ="Hello World"
I believe this will work in both VB.Net and C#!!
Seriously, there are plenty of examples and how to out there try:
I have no idea how you would get it for free... I generally code my own stuff
This thread is five years old....
Anyway you should check the reader returns something first:
if (objdatareader.HasRows)
objdatareader.Read();
You could always let the client do the work...
<a href="mailto:me@somewhere.com?subject=Mysubject">Mail Me</a>
OK it depends on them having an email client installed and you will have to monitor the account...
If you have the clientside function already written in the aspx file you don't need to register it server side.
I'm also not sure what you are doing here:
Dim localScreenWidth As String = " <script type='text/javascript'>showDialogue();</script>"
Basically call the javascript clientside to update the hidden field values then in the page post back read the values server side
Remember the page has two sides, Client which is run on the browser and server. The only way the server side knows what is happening client side is if the data page is posted back to the server.
I assume txtNumRows is supposed to be a Textbox on your form to display the number of rows...
Ajax would allow you to change and populate the tab each time without refreshing the whole page so it could work for you.
Good luck....
From what your saying you can get any number of files containing an unspecified amount data in any order in any format and somehow you need to break the data down and match it up to produce a single file with all the data.
If I were you, I'd see if I could get my data files in set formats first. Then you could open each file, check which format it is in (by file name, or parsing the first couple of rows of data to see what is in each column then matching this to a format or any other way you have) and have a routine for processing each different format of file.
Using the example TnTinMN put above if you may get a space after the last comma and don't want the empty entry use trim on the string first.
dim s as String = trim(MyString)
dim parts() as string = s.split(New Char() {","c} StringSplitOptions.RemoveEmptyEntries)
Why do all this extra coding? Masked textbox has it all built in...
If you are using any of these methods, you will have to refresh your datagridview to show the updated records....
Hi
You could use a data reader to parse through your records and add them to the listView:
Dim item As ListViewItem
Dim item2 As ListViewItem
While DR.Read
item2= new ListviewItem(DR("kilograms"))
item = new ListviewItem(DR("food"))
item.subitems.add(item2)
Listview1.items.add(item)
End While
Ok to get the selected items subitems:
Dim item As ListViewItem = listview1.Selecteditems(0)
Dim Position as String = item.SubItems(2).Text
'First Item is main item and index is zero based
You haven't stated where attendance is coming from but you'd do something like this:
If Position ="Driver" And Attendence = "IN" then
Combobox1.Items.add(item.text)
Else
Msgbox(Item.text &" is Out")
End if
I'm not 100% sure about Oracle but I know if you set a field up as a datetime in SQL Server for instance, if you pass in a time value it will automatically append todays date and if you only pass in a date it will automatically append a time value of "00:00:00" i.e. midnight.
I suggest if you wish to store only a time value you change the field's datatype to a string of some description.
Like Begginnerdev said check the To and From values Also? why use a textbox would you not be better with a combobox and give the users fixed values of currency?