473,382 Members | 1,635 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

problems with code can someone help??

Ron
I am having a bit of problem with this code:

Dim cmd As New OleDb.OleDbCommand("INSERT INTO help (Name, Email,
telephone, description)VALUES('" & txtName.Text & "','" &
txtEmail.Text & "','" & txtTelephone.Text & "','" &
txtDescription.Text & "')", New OleDb.OleDbConnection(strconn))

at the end, strconn is underlined in blue and says not defined, I
dont know what to do with this, how do I define it?

Also I have 2 forms...one button shold hide the one form and show
another, here is the code I have and it is not working:

Form2.Show()
Me.Hide()

it does nothing, the new form does not show and me does not hide.

thanks for any help.

May 8 '07 #1
4 1471
On May 8, 12:47 pm, Ron <pts4...@yahoo.comwrote:
I am having a bit of problem with this code:

Dim cmd As New OleDb.OleDbCommand("INSERT INTO help (Name, Email,
telephone, description)VALUES('" & txtName.Text & "','" &
txtEmail.Text & "','" & txtTelephone.Text & "','" &
txtDescription.Text & "')", New OleDb.OleDbConnection(strconn))

at the end, strconn is underlined in blue and says not defined, I
dont know what to do with this, how do I define it?

Also I have 2 forms...one button shold hide the one form and show
another, here is the code I have and it is not working:

Form2.Show()
Me.Hide()

it does nothing, the new form does not show and me does not hide.

thanks for any help.
at the end, strconn is underlined in blue and says not defined, I
dont know what to do with this, how do I define it?
I guessing that strconn is supposed to be a string that equals your
OleDb connection string to your database. To get the appropriate
format see www.connectionstrings.com

Here's is how I would write your code:

Dim conn As New OleDbConnection("enter your connection string here")
Using (conn)
conn.Open()
Dim com As OleDbCommand = conn.CreateCommand()
Using (com)
com.CommandType = CommandType.Text
com.CommandText = String.Format("Insert Into help(Name, Email,
telephone, description) Values ('{0}', '{1}', '{2}', '{3}')",
txtName.Text, txtEmail.Text, txtTelephone.Text, txtDescription.Text)
com.ExecuteNonQuery()
End Using
End Using
Also I have 2 forms...one button shold hide the one form and show
another, here is the code I have and it is not working:
Try this:

Dim f As New Form2()
f.Show()
Me.Hide()

That should create a new instance (instantiate) of Form2 and show it.
Immediately afterwards it will hide the calling form. Is that what you
were looking for?

Thanks,

Seth Rowe

May 8 '07 #2
Ron
On May 8, 1:22 pm, rowe_newsgroups <rowe_em...@yahoo.comwrote:
On May 8, 12:47 pm, Ron <pts4...@yahoo.comwrote:
I am having a bit of problem with this code:
Dim cmd As New OleDb.OleDbCommand("INSERT INTO help (Name, Email,
telephone, description)VALUES('" & txtName.Text & "','" &
txtEmail.Text & "','" & txtTelephone.Text & "','" &
txtDescription.Text & "')", New OleDb.OleDbConnection(strconn))
at the end, strconn is underlined in blue and says not defined, I
dont know what to do with this, how do I define it?
Also I have 2 forms...one button shold hide the one form and show
another, here is the code I have and it is not working:
Form2.Show()
Me.Hide()
it does nothing, the new form does not show and me does not hide.
thanks for any help.
at the end, strconn is underlined in blue and says not defined, I
dont know what to do with this, how do I define it?

I guessing that strconn is supposed to be a string that equals your
OleDb connection string to your database. To get the appropriate
format seewww.connectionstrings.com

Here's is how I would write your code:

Dim conn As New OleDbConnection("enter your connection string here")
Using (conn)
conn.Open()
Dim com As OleDbCommand = conn.CreateCommand()
Using (com)
com.CommandType = CommandType.Text
com.CommandText = String.Format("Insert Into help(Name, Email,
telephone, description) Values ('{0}', '{1}', '{2}', '{3}')",
txtName.Text, txtEmail.Text, txtTelephone.Text, txtDescription.Text)
com.ExecuteNonQuery()
End Using
End Using
Also I have 2 forms...one button shold hide the one form and show
another, here is the code I have and it is not working:

Try this:

Dim f As New Form2()
f.Show()
Me.Hide()

That should create a new instance (instantiate) of Form2 and show it.
Immediately afterwards it will hide the calling form. Is that what you
were looking for?

Thanks,

Seth Rowe
thanks, I tried, ther strconn went away but now when I open form2,
or go to it by pressing the button and go into a textbox by clicking
in a textbox I get an error LoaderLock detected

May 8 '07 #3
On May 8, 1:31 pm, Ron <pts4...@yahoo.comwrote:
On May 8, 1:22 pm, rowe_newsgroups <rowe_em...@yahoo.comwrote:
On May 8, 12:47 pm, Ron <pts4...@yahoo.comwrote:
I am having a bit of problem with this code:
Dim cmd As New OleDb.OleDbCommand("INSERT INTO help (Name, Email,
telephone, description)VALUES('" & txtName.Text & "','" &
txtEmail.Text & "','" & txtTelephone.Text & "','" &
txtDescription.Text & "')", New OleDb.OleDbConnection(strconn))
at the end, strconn is underlined in blue and says not defined, I
dont know what to do with this, how do I define it?
Also I have 2 forms...one button shold hide the one form and show
another, here is the code I have and it is not working:
Form2.Show()
Me.Hide()
it does nothing, the new form does not show and me does not hide.
thanks for any help.
at the end, strconn is underlined in blue and says not defined, I
dont know what to do with this, how do I define it?
I guessing that strconn is supposed to be a string that equals your
OleDb connection string to your database. To get the appropriate
format seewww.connectionstrings.com
Here's is how I would write your code:
Dim conn As New OleDbConnection("enter your connection string here")
Using (conn)
conn.Open()
Dim com As OleDbCommand = conn.CreateCommand()
Using (com)
com.CommandType = CommandType.Text
com.CommandText = String.Format("Insert Into help(Name, Email,
telephone, description) Values ('{0}', '{1}', '{2}', '{3}')",
txtName.Text, txtEmail.Text, txtTelephone.Text, txtDescription.Text)
com.ExecuteNonQuery()
End Using
End Using
Also I have 2 forms...one button shold hide the one form and show
another, here is the code I have and it is not working:
Try this:
Dim f As New Form2()
f.Show()
Me.Hide()
That should create a new instance (instantiate) of Form2 and show it.
Immediately afterwards it will hide the calling form. Is that what you
were looking for?
Thanks,
Seth Rowe

thanks, I tried, ther strconn went away but now when I open form2,
or go to it by pressing the button and go into a textbox by clicking
in a textbox I get an error LoaderLock detected
Wow - that was a scrambled sentence. First things first - the database
interaction is working and form2 is showing right?

Thanks,

Seth Rowe

May 8 '07 #4
Ron
On May 8, 1:38 pm, rowe_newsgroups <rowe_em...@yahoo.comwrote:
On May 8, 1:31 pm, Ron <pts4...@yahoo.comwrote:
On May 8, 1:22 pm, rowe_newsgroups <rowe_em...@yahoo.comwrote:
On May 8, 12:47 pm, Ron <pts4...@yahoo.comwrote:
I am having a bit of problem with this code:
Dim cmd As New OleDb.OleDbCommand("INSERT INTO help (Name, Email,
telephone, description)VALUES('" & txtName.Text & "','" &
txtEmail.Text & "','" & txtTelephone.Text & "','" &
txtDescription.Text & "')", New OleDb.OleDbConnection(strconn))
at the end, strconn is underlined in blue and says not defined, I
dont know what to do with this, how do I define it?
Also I have 2 forms...one button shold hide the one form and show
another, here is the code I have and it is not working:
Form2.Show()
Me.Hide()
it does nothing, the new form does not show and me does not hide.
thanks for any help.
at the end, strconn is underlined in blue and says not defined, I
dont know what to do with this, how do I define it?
I guessing that strconn is supposed to be a string that equals your
OleDb connection string to your database. To get the appropriate
format seewww.connectionstrings.com
Here's is how I would write your code:
Dim conn As New OleDbConnection("enter your connection string here")
Using (conn)
conn.Open()
Dim com As OleDbCommand = conn.CreateCommand()
Using (com)
com.CommandType = CommandType.Text
com.CommandText = String.Format("Insert Into help(Name, Email,
telephone, description) Values ('{0}', '{1}', '{2}', '{3}')",
txtName.Text, txtEmail.Text, txtTelephone.Text, txtDescription.Text)
com.ExecuteNonQuery()
End Using
End Using
Also I have 2 forms...one button shold hide the one form and show
another, here is the code I have and it is not working:
Try this:
Dim f As New Form2()
f.Show()
Me.Hide()
That should create a new instance (instantiate) of Form2 and show it.
Immediately afterwards it will hide the calling form. Is that what you
were looking for?
Thanks,
Seth Rowe
thanks, I tried, ther strconn went away but now when I open form2,
or go to it by pressing the button and go into a textbox by clicking
in a textbox I get an error LoaderLock detected

Wow - that was a scrambled sentence. First things first - the database
interaction is working and form2 is showing right?

Thanks,

Seth Rowe
Wow yes I don't know what happened with that sentence. Anyway, yes
the database is read into a datagrid and displayed on form1 at
startup, on load.

here is my code for both forms.
this is for form1.vb, frmmain

Imports System.Data.OleDb
Public Class frmMain

Dim olecn As New _
OleDb.OleDbConnection("Provider=Microsoft.jet.oled b.4.0;" & _
"Data Source=helpdesk.mdb")

Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnExit.Click
Me.Close()

End Sub

Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim olecmd As New OleDbCommand _
("Select * from help", olecn)

Dim oleda As New OleDbDataAdapter(olecmd)

Dim oleds As New DataSet
oleda.Fill(oleds)

dgvHelp.DataSource = oleds.Tables(0)
End Sub

Private Sub dgvHelp_CellContentClick(ByVal sender As
System.Object, ByVal e As
System.Windows.Forms.DataGridViewCellEventArgs) Handles
dgvHelp.CellContentClick

End Sub

Private Sub btnNewCall_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles btnNewCall.Click
Dim f As New Form2()
f.Show()
Me.Hide()
End Sub
End Class

this is for form2, form2
Imports System.Data.OleDb

Public Class Form2

Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnAdd.Click
Dim conn As New OleDbConnection("enter your connection string
here")
Using (conn)
conn.Open()
Dim com As OleDbCommand = conn.CreateCommand()
Using (com)
com.CommandType = CommandType.Text
com.CommandText = String.Format("Insert Into
help(Name, Email, telephone, description) Values ('{0}', '{1}', '{2}',
'{3}')", txtName.Text, txtEmail.Text, txtTelephone.Text,
txtDescription.Text)
com.ExecuteNonQuery()
End Using
End Using
End sub
End Class

May 8 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Arturo DiDonna | last post by:
Hello everyone. I am trying to compile someone else code and I am stuck with compilation problems using the g++ 3.3 compiler. Basically, when compiling the following code, I get this error...
19
by: Jim | last post by:
I have spent the past few weeks designing a database for my company. The problem is I have started running into what I believe are stack overflow problems. There are two tab controls on the form...
3
by: Andi Twine | last post by:
Hi all, I really hope someone here can help ! I have designed and built an ASP.NET web service with Visual Studio .NET. The web service outputs some dummy XML data when its called with some...
0
by: ZMan | last post by:
Scenario: This is about debugging server side scripts that make calls to middle-tier business DLLs. The server side scripts are legacy ASP 3.0 pages, and the DLLs are managed DLLs...
2
by: Brian | last post by:
NOTE ALSO POSTED IN microsoft.public.dotnet.framework.aspnet.buildingcontrols I have solved most of my Server Control Collection property issues. I wrote an HTML page that describes all of the...
21
by: matvdl | last post by:
I have a system that was originally developed in asp - the pages are saved in SQL (there are over 10,000 pages) and saved to a temp directory in the server when requested by a client. I have...
6
by: Oliver | last post by:
I have a very wired problem requesting one specific url from within my application. I have struggeled with this for 5 hours now, and searched google withour any luck, so i hope that someone are...
18
by: TORQUE | last post by:
Hi, Im wondering if anyone can help me with a problem. I have a form with more than 50 unbound fields. Some of the fields will be blank from time to time. This seems to be where im having...
0
by: David | last post by:
Hello all. I am trying to implement my first server control and have run into two problems that I cannot solve. I need the assistance of someone with more experience. My goal was to create an...
12
truthlover
by: truthlover | last post by:
I have a problem that's difficult to explain, so please be patient. The database is in 2000 format, though I'm doing most of the designing in 2007 (saved as 2000 format, of course) I have a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.