Click here to Skip to main content
15,920,031 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerYour question is not directly related to vb.net Pin
JUNEYT11-Apr-06 11:44
JUNEYT11-Apr-06 11:44 
QuestionIn my VS2003 project I send mail and it sends 7-8 times every time I send it? Pin
kenn_rosie10-Apr-06 19:29
kenn_rosie10-Apr-06 19:29 
QuestionIn my Global asax file aDo I need the code below newmail.fields.add and why do I need them? Pin
kenn_rosie10-Apr-06 19:15
kenn_rosie10-Apr-06 19:15 
Questionit saving two records instead of one Pin
Amit Agarrwal10-Apr-06 19:12
Amit Agarrwal10-Apr-06 19:12 
GeneralRe: it saving two records instead of one Pin
Guffa10-Apr-06 22:30
Guffa10-Apr-06 22:30 
GeneralRe: it saving two records instead of one Pin
Amit Agarrwal10-Apr-06 23:19
Amit Agarrwal10-Apr-06 23:19 
GeneralRe: it saving two records instead of one Pin
Guffa11-Apr-06 1:42
Guffa11-Apr-06 1:42 
GeneralRe: it saving two records instead of one Pin
Amit Agarrwal11-Apr-06 2:15
Amit Agarrwal11-Apr-06 2:15 
Imports System.Data
Imports System.Data.Odbc
Partial Class Category
Inherits System.Web.UI.Page
Public x As Integer
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ConnStr As String = "Driver={MySQL ODBC 3.51 Driver};Server=localhost;Database=AgentImg;uid=root;pwd=;option=3"
Dim con As OdbcConnection = New OdbcConnection(ConnStr)

'Dim InsCom As OdbcCommand = New OdbcCommand(str, con)
'con.Open()
'Dim str As String = "insert into Category(Name,address,age,city) values('"&Name&"','"&Address&"','"&Age&"','"&City&"')"
'sqlCmd.CommandText = str
'sqlCmd.CommandType = CommandType.Text
'sqlCmd.Connection = con
'sqlCmd.ExecuteNonQuery()

Dim str1 As String
Dim ad As OdbcDataAdapter = New OdbcDataAdapter()

str1 = "insert into Category(id,Category_Name,Category_Price,Category_Img,Category_Desc,Category_header) Values('','" & TextBox1.Text & "', '" & TextBox2.Text & "','" & FileUpload1.FileName & "','" & TextBox4.Text & "','" & TextBox5.Text & "' )"
'If (Option1.Items(1).Value = 1) Then
'str = "insert into Category(id,Category_Name,Category_Price,Category_Img,Category_Desc,Category_header) Values('','" & TextBox1.Text & "', '" & TextBox2.Text & "','" & FileUpload1.FileName & "','" & TextBox4.Text & "','" & TextBox5.Text & "' )"
'Else
'str = "insert into Category(id,Category_Name,Category_Price,Category_Img,Category_Desc,Category_header) Values('','" & TextBox1.Text & "', '' ,'" & FileUpload1.FileName & "','" & TextBox4.Text & "','" & TextBox5.Text & "' )"
' End If
'If (Option1.Items(1).Selected = True) Then

'Dim str As String = "insert into Category values('',@Category_Name,'',@Category_Desc)"

Dim InsCom As OdbcCommand = New OdbcCommand(str1, con)


If Not FileUpload1.PostedFile Is Nothing And FileUpload1.PostedFile.ContentLength > 0 Then
Dim fn As String = System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName)

Dim SaveLocation As String = Server.MapPath("images") & "\" & fn
Try
FileUpload1.PostedFile.SaveAs(SaveLocation)
Catch Exc As Exception
'Response.Write("Error: " & Exc.Message)
End Try
Else
Response.Write("Please select a file to upload.")
End If

'Dim str As String = "insert into names values(@Name,@Addres,@Age,@City)"
'Dim str As String = "insert into Category(@id,@Category_Name,@Category_Img,@Category_Desc)"

'con.Open()

con.Open()
InsCom.ExecuteNonQuery()

'ExecuteNonQuery()
'MsgBox("insert into Category values('2',@Category_Name,'',@Category_Desc)")
'InsCom.ExecuteReader()
' GridView1.DataSource = InsCom.ExecuteReader()
'GridView1.DataBind()
TextBox1.Text = ""
TextBox2.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
con.Close()
End Sub
Protected Sub RadioButtonList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Option1.SelectedIndexChanged
If (Option1.Items(0).Selected = True) Then
' x = 1
TextBox2.Enabled = True
End If

If (Option1.Items(1).Selected = True) Then
x = 2
TextBox2.Enabled = False

End If
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If (Page.IsPostBack = False) Then
x = 1
End If
End Sub
End Class
AnswerRe: it saving two records instead of one Pin
Guffa11-Apr-06 3:45
Guffa11-Apr-06 3:45 
Questiondatagrid in vb.net Pin
pankajgarg1210-Apr-06 18:53
pankajgarg1210-Apr-06 18:53 
AnswerRe: datagrid in vb.net Pin
Amit Agarrwal10-Apr-06 19:14
Amit Agarrwal10-Apr-06 19:14 
Questioninterview questions Pin
pankajgarg1210-Apr-06 18:49
pankajgarg1210-Apr-06 18:49 
AnswerRe: interview questions Pin
Steve Pullan11-Apr-06 13:55
Steve Pullan11-Apr-06 13:55 
GeneralRe: interview questions Pin
Dave Kreskowiak11-Apr-06 17:26
mveDave Kreskowiak11-Apr-06 17:26 
GeneralRe: interview questions Pin
Steve Pullan11-Apr-06 17:54
Steve Pullan11-Apr-06 17:54 
QuestionHow to display selected field in crystal report Pin
sparkycodeproject10-Apr-06 16:11
sparkycodeproject10-Apr-06 16:11 
Questionvb.net modify mdb database NEED HELP! Pin
ckkc456710-Apr-06 15:49
ckkc456710-Apr-06 15:49 
AnswerRe: vb.net modify mdb database NEED HELP! Pin
Chatura Dilan10-Apr-06 17:27
Chatura Dilan10-Apr-06 17:27 
GeneralRe: vb.net modify mdb database NEED HELP! Pin
ckkc456710-Apr-06 18:59
ckkc456710-Apr-06 18:59 
GeneralRe: vb.net modify mdb database NEED HELP! Pin
Chatura Dilan10-Apr-06 23:11
Chatura Dilan10-Apr-06 23:11 
Question2 frameworks on 1 machine Pin
gtu12285510-Apr-06 14:27
gtu12285510-Apr-06 14:27 
AnswerRe: 2 frameworks on 1 machine Pin
Joshua Quick10-Apr-06 15:16
Joshua Quick10-Apr-06 15:16 
AnswerRe: 2 frameworks on 1 machine Pin
CWIZO10-Apr-06 20:37
CWIZO10-Apr-06 20:37 
Questioni don't know Pin
SVb.net10-Apr-06 13:30
SVb.net10-Apr-06 13:30 
AnswerRe: i don't know Pin
Chatura Dilan10-Apr-06 17:16
Chatura Dilan10-Apr-06 17:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.