Jump to content
Forumu Destekleyenlere Katılın ×
Paticik Forumları
2000 lerden beri faal olan, çok şukela bir paylaşım platformuyuz. Hoşgeldiniz.

SQL Nonquery Problemi...


Prawler

Öne çıkan mesajlar

Merhabalar,
Visual Studio.net te üye kayıt formu hazırlarken, sql bağlantısını kurarken şöyle bir sorun ortaya çıkıyor. Yardımcı olursanız sevinirim =) Bir de SERDAR Databaseinin altında Uye tablosu diye bir tablo var.Butun ID leri doğru...

Kod:
Private Sub Gonder_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Gonder.Click
Dim connectionString As String = "server=localhost;DataBase=Serdar;uid=serdar;pwd=xxxx"
Dim connection As SqlConnection = New SqlConnection(connectionString)
Console.WriteLine("SQLConnection saglandi")

Dim sql As String = "insert into UyeTablosu(UyeAD,UyeSOYAD,UyeEMAIL,UyeCINSIYET,UyeMEDENIHAL,UyeSEHIR,UyeSEMT,UyeED,UyeSIRKET) Values(@Ad,@Soyad,@Email,@Cinsiyet,@MedeniHal,@Sehir,@Semt,@ED,@Sirket)"
Dim command As SqlCommand = New SqlCommand(sql, connection)
command.Parameters.Add("@Ad", TxtAD.Text)
command.Parameters.Add("@Soyad", TxtSOYAD.Text)
command.Parameters.Add("@Email", TxtEMAIL.Text)

If RadioButtonERKEK.Checked Then
command.Parameters.Add("@Cinsiyet", "Erkek")
End If
Select Case DropDownListSEHIR.SelectedValue
Case "Istanbul"
command.Parameters.Add("@Sehir", "Istanbul")
Case "Ankara"
command.Parameters.Add("@Sehir", "Ankara")
Case "Adana"
command.Parameters.Add("@Sehir", "Adana")
Case "Antalya"
command.Parameters.Add("@Sehir", "Antalya")
End Select
If RadioButtonBAYAN.Checked Then
command.Parameters.Add("@Cinsiyet", "Bayan")
End If
If RadioButtonEVLI.Checked Then
command.Parameters.Add("@MedeniHal", "Evli")
End If
If RadioButtonBEKAR.Checked Then
command.Parameters.Add("@MedeliHal", "Bekar")

End If

command.Parameters.Add("@Semt", TxtSemt.Text)
command.Parameters.Add("@ED", TxtED.Text)
command.Parameters.Add("@Sirket", TxtSIRKET.Text)
connection.Open()
Dim result As Integer = command.ExecuteNonQuery()
Console.WriteLine("sonuç: " & result)
End Sub


Çıkan hata ise:
Server Error in '/eposta' Application.
--------------------------------------------------------------------------------

Invalid object name 'UyeTablosu'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Invalid object name 'UyeTablosu'.

Source Error:


Line 90: command.Parameters.Add("@Sirket", TxtSIRKET.Text)
Line 91: connection.Open()
Line 92: Dim result As Integer = command.ExecuteNonQuery()
Line 93: Console.WriteLine("sonuç: " & result)
Line 94: End Sub


Source File: c:inetpubwwwrootepostauyekayit.aspx.vb Line: 92

Stack Trace:


[SqlException: Invalid object name 'UyeTablosu'.]
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream) +723
System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +196
eposta.WebForm1.Gonder_Click(Object sender, EventArgs e) in c:inetpubwwwrootepostauyekayit.aspx.vb:92
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1277
[signature][hline]Everytime I see you falling I get down on my knees and pray.
I'm waiting for the final moment you say the words that I can't say...

SAKLI SOKAK | Yiyorsa tıkla!

Link to comment
Sosyal ağlarda paylaş

UyeTablosu diye bişey yok diyor . Bu arada sql komutlarını neden kendi elinle girmiyorsun ? daha rahat kullanırsın[signature][hline]Her sabah yolunu gözlerim ,
Buğdayların arasındaki yeşil okyanusları görebilmek ,
Kır çiçeklerinin kokusunu duyabilmek ,
Beni sevdiğini hayal edebilmek için...
Geyyik
[Bu imza zgrw tarafından 18 January 2004 17:38 tarihinde değiştirilmiştir]
Link to comment
Sosyal ağlarda paylaş

yok tabloların isimleri düzgün...
O sorunu hallettim şimdi bir de bu çıktı


Server Error in '/eposta' Application.
--------------------------------------------------------------------------------

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:


Line 62: command.Parameters.Add("@Cinsiyet", "DropDownListCINSIYET.SelectedValue")
Line 63: command.Parameters.Add("@Medeni Hal", "DropDownListMEDENI.SelectedValue")
Line 64: command.Parameters.Add("@ED", TxtED.Text)
Line 65: command.Parameters.Add("@Sirket", TxtSIRKET.Text)
Line 66: command.Parameters.Add("@Semt", TxtSEMT.Text)


Source File: c:inetpubwwwrootepostauyekayit.aspx.vb Line: 64

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
eposta.WebForm1.Gonder_Click(Object sender, EventArgs e) in c:inetpubwwwrootepostauyekayit.aspx.vb:64
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1277[signature][hline]Everytime I see you falling I get down on my knees and pray.
I'm waiting for the final moment you say the words that I can't say...

SAKLI SOKAK | Yiyorsa tıkla!

Link to comment
Sosyal ağlarda paylaş

×
  • Yeni Oluştur...