Showing posts with label cmd. Show all posts
Showing posts with label cmd. Show all posts

Friday, March 23, 2012

problem with add money value from text box to SQL table

Hi...

I have problem with add money value from text box to SQL table

This is my statment

cmd.Parameters.Add(

"@.minbid", Data.SqlDbType.SmallMoney)

cmd.Parameters.Add(

"@.minIncrement", Data.SqlDbType.SmallMoney)

can any one help meCrying [:'(]

You might want to "describe" what the problem is. Perhaps post the error message?|||

Hi..

Tanke you for reply ...I think the problem is when the user enter to the text box int value ..

ex:

min bid = 100 --> The user inter it

I think to solve the problem is to format the user input to money value ...but how I do that

pleaze if any one have a solution to reply please as soon as posiple.

thanks alot

Wednesday, March 21, 2012

problem with a date parameter in ASP.Net page

The date format in the 'weekending' textbox is 5/5/2007
Here's what I've got:

With cmd.Parameters
.Add(New SqlParameter("@.SQLweekending", SqlDbType.DateTime,weekending.Text))
the error message is:
"Conversion from string "4/8/2007" to type 'Integer' is not valid."

Then, I tried:
.Add(

New SqlParameter("@.SQLweekending", SqlDbType.DateTime,CDate(weekending.Text)))

but, before I even tried it, it gave me a blue squiggly line, with an error message:
"Error 2 Value of type 'Date' cannot be converted to 'Integer'"

How can I get this to work?

Hi,

What is the data type for yourSQLweekending column in your table? Is it a DateTime column or Integer type? You need a DateTime column for this.

|||Nope - it's datetime also|||

Here is sample in VB.NET that inserts date to a datetime column:

Dim MySQLAsString ="Insert into Dates (id, tDate) values (@.id, @.tDate)"Dim myConnAs SqlConnection =New SqlConnection(ConfigurationManager.ConnectionStrings("forumConnectionString").ConnectionString.ToString())Dim CmdAsNew SQLCommand(MySQL, MyConn)

Cmd.Parameters.Add(

New SqlParameter("@.id", txtid.Text))

Cmd.Parameters.Add(

New SqlParameter("@.tDate",txttDate.Text))

MyConn.Open()

cmd.ExecuteNonQuery()

MyConn.Close()sql